Object

org.apache.spark.ml.stat

Summarizer

Related Doc: package stat

Permalink

object Summarizer extends Logging

Tools for vectorized statistics on MLlib Vectors.

The methods in this package provide various statistics for Vectors contained inside DataFrames.

This class lets users pick the statistics they would like to extract for a given column. Here is an example in Scala:

import org.apache.spark.ml.linalg._
import org.apache.spark.sql.Row
val dataframe = ... // Some dataframe containing a feature column and a weight column
val multiStatsDF = dataframe.select(
    Summarizer.metrics("min", "max", "count").summary($"features", $"weight")
val Row(Row(minVec, maxVec, count)) = multiStatsDF.first()

If one wants to get a single metric, shortcuts are also available:

val meanDF = dataframe.select(Summarizer.mean($"features"))
val Row(meanVec) = meanDF.first()

Note: Currently, the performance of this interface is about 2x~3x slower than using the RDD interface.

Annotations
@Experimental() @Since( "2.3.0" )
Source
Summarizer.scala
Linear Supertypes
Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Summarizer
  2. Logging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def count(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  7. def count(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean = false): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  14. def initializeLogIfNecessary(isInterpreter: Boolean): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. def isTraceEnabled(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  17. def log: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  18. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  19. def logDebug(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  20. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  21. def logError(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  22. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  23. def logInfo(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  24. def logName: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  25. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  26. def logTrace(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  27. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  28. def logWarning(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  29. def max(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  30. def max(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  31. def mean(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  32. def mean(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  33. def metrics(metrics: String*): SummaryBuilder

    Permalink

    Given a list of metrics, provides a builder that it turns computes metrics from a column.

    Given a list of metrics, provides a builder that it turns computes metrics from a column.

    See the documentation of Summarizer for an example.

    The following metrics are accepted (case sensitive):

    • mean: a vector that contains the coefficient-wise mean.
    • variance: a vector tha contains the coefficient-wise variance.
    • count: the count of all vectors seen.
    • numNonzeros: a vector with the number of non-zeros for each coefficients
    • max: the maximum for each coefficient.
    • min: the minimum for each coefficient.
    • normL2: the Euclidian norm for each coefficient.
    • normL1: the L1 norm of each coefficient (sum of the absolute values).
    metrics

    metrics that can be provided.

    returns

    a builder.

    Annotations
    @Since( "2.3.0" ) @varargs()
    Exceptions thrown

    IllegalArgumentException if one of the metric names is not understood. Note: Currently, the performance of this interface is about 2x~3x slower then using the RDD interface.

  34. def min(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  35. def min(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  36. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  37. def normL1(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  38. def normL1(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  39. def normL2(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  40. def normL2(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  41. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  42. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  43. def numNonZeros(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  44. def numNonZeros(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  45. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  46. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  47. def variance(col: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  48. def variance(col: Column, weightCol: Column): Column

    Permalink
    Annotations
    @Since( "2.3.0" )
  49. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Members