Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package apache
    Definition Classes
    org
  • package spark

    Core Spark functionality.

    Core Spark functionality. org.apache.spark.SparkContext serves as the main entry point to Spark, while org.apache.spark.rdd.RDD is the data type representing a distributed collection, and provides most parallel operations.

    In addition, org.apache.spark.rdd.PairRDDFunctions contains operations available only on RDDs of key-value pairs, such as groupByKey and join; org.apache.spark.rdd.DoubleRDDFunctions contains operations available only on RDDs of Doubles; and org.apache.spark.rdd.SequenceFileRDDFunctions contains operations available on RDDs that can be saved as SequenceFiles. These operations are automatically available on any RDD of the right type (e.g. RDD[(Int, Int)] through implicit conversions.

    Java programmers should reference the org.apache.spark.api.java package for Spark programming APIs in Java.

    Classes and methods marked with Experimental are user-facing features which have not been officially adopted by the Spark project. These are subject to change or removal in minor releases.

    Classes and methods marked with Developer API are intended for advanced users want to extend Spark through lower level interfaces. These are subject to changes or removal in minor releases.

    Definition Classes
    apache
  • package ml

    DataFrame-based machine learning APIs to let users quickly assemble and configure practical machine learning pipelines.

    DataFrame-based machine learning APIs to let users quickly assemble and configure practical machine learning pipelines.

    Definition Classes
    spark
  • package feature

    The ml.feature package provides common feature transformers that help convert raw data or features into more suitable forms for model fitting.

    Feature transformers

    The ml.feature package provides common feature transformers that help convert raw data or features into more suitable forms for model fitting. Most feature transformers are implemented as Transformers, which transform one DataFrame into another, e.g., HashingTF. Some feature transformers are implemented as Estimators, because the transformation requires some aggregated information of the dataset, e.g., document frequencies in IDF. For those feature transformers, calling Estimator.fit is required to obtain the model first, e.g., IDFModel, in order to apply transformation. The transformation is usually done by appending new columns to the input DataFrame, so all input columns are carried over.

    We try to make each transformer minimal, so it becomes flexible to assemble feature transformation pipelines. Pipeline can be used to chain feature transformers, and VectorAssembler can be used to combine multiple feature transformations, for example:

    import org.apache.spark.ml.feature._
    import org.apache.spark.ml.Pipeline
    
    // a DataFrame with three columns: id (integer), text (string), and rating (double).
    val df = spark.createDataFrame(Seq(
      (0, "Hi I heard about Spark", 3.0),
      (1, "I wish Java could use case classes", 4.0),
      (2, "Logistic regression models are neat", 4.0)
    )).toDF("id", "text", "rating")
    
    // define feature transformers
    val tok = new RegexTokenizer()
      .setInputCol("text")
      .setOutputCol("words")
    val sw = new StopWordsRemover()
      .setInputCol("words")
      .setOutputCol("filtered_words")
    val tf = new HashingTF()
      .setInputCol("filtered_words")
      .setOutputCol("tf")
      .setNumFeatures(10000)
    val idf = new IDF()
      .setInputCol("tf")
      .setOutputCol("tf_idf")
    val assembler = new VectorAssembler()
      .setInputCols(Array("tf_idf", "rating"))
      .setOutputCol("features")
    
    // assemble and fit the feature transformation pipeline
    val pipeline = new Pipeline()
      .setStages(Array(tok, sw, tf, idf, assembler))
    val model = pipeline.fit(df)
    
    // save transformed features with raw data
    model.transform(df)
      .select("id", "text", "rating", "features")
      .write.format("parquet").save("/output/path")

    Some feature transformers implemented in MLlib are inspired by those implemented in scikit-learn. The major difference is that most scikit-learn feature transformers operate eagerly on the entire input dataset, while MLlib's feature transformers operate lazily on individual columns, which is more efficient and flexible to handle large and complex datasets.

    Definition Classes
    ml
    See also

    scikit-learn.preprocessing

  • object ChiSqSelectorModel extends MLReadable[ChiSqSelectorModel] with Serializable
    Definition Classes
    feature
    Annotations
    @Since( "1.6.0" )
  • ChiSqSelectorModelWriter
c

org.apache.spark.ml.feature.ChiSqSelectorModel

ChiSqSelectorModelWriter

class ChiSqSelectorModelWriter extends MLWriter

Source
ChiSqSelector.scala
Linear Supertypes
MLWriter, Logging, BaseReadWrite, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ChiSqSelectorModelWriter
  2. MLWriter
  3. Logging
  4. BaseReadWrite
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ChiSqSelectorModelWriter(instance: ChiSqSelectorModel)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  10. def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  11. def initializeLogIfNecessary(isInterpreter: Boolean): Unit
    Attributes
    protected
    Definition Classes
    Logging
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. def isTraceEnabled(): Boolean
    Attributes
    protected
    Definition Classes
    Logging
  14. def log: Logger
    Attributes
    protected
    Definition Classes
    Logging
  15. def logDebug(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  16. def logDebug(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  17. def logError(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  18. def logError(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  19. def logInfo(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  20. def logInfo(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  21. def logName: String
    Attributes
    protected
    Definition Classes
    Logging
  22. def logTrace(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  23. def logTrace(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  24. def logWarning(msg: ⇒ String, throwable: Throwable): Unit
    Attributes
    protected
    Definition Classes
    Logging
  25. def logWarning(msg: ⇒ String): Unit
    Attributes
    protected
    Definition Classes
    Logging
  26. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  28. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  29. def option(key: String, value: String): ChiSqSelectorModelWriter.this.type

    Adds an option to the underlying MLWriter.

    Adds an option to the underlying MLWriter. See the documentation for the specific model's writer for possible options. The option name (key) is case-insensitive.

    Definition Classes
    MLWriter
    Annotations
    @Since( "2.3.0" )
  30. val optionMap: Map[String, String]

    Map to store extra options for this writer.

    Map to store extra options for this writer.

    Attributes
    protected
    Definition Classes
    MLWriter
  31. def overwrite(): ChiSqSelectorModelWriter.this.type

    Overwrites if the output path already exists.

    Overwrites if the output path already exists.

    Definition Classes
    MLWriter
    Annotations
    @Since( "1.6.0" )
  32. def save(path: String): Unit

    Saves the ML instances to the input path.

    Saves the ML instances to the input path.

    Definition Classes
    MLWriter
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  33. def saveImpl(path: String): Unit

    save() handles overwriting and then calls this method.

    save() handles overwriting and then calls this method. Subclasses should override this method to implement the actual saving of the instance.

    Attributes
    protected
    Definition Classes
    ChiSqSelectorModelWriterMLWriter
  34. final def sc: SparkContext

    Returns the underlying SparkContext.

    Returns the underlying SparkContext.

    Attributes
    protected
    Definition Classes
    BaseReadWrite
  35. def session(sparkSession: SparkSession): ChiSqSelectorModelWriter.this.type

    Sets the Spark Session to use for saving/loading.

    Sets the Spark Session to use for saving/loading.

    Definition Classes
    MLWriter → BaseReadWrite
    Annotations
    @Since( "1.6.0" )
  36. var shouldOverwrite: Boolean
    Attributes
    protected
    Definition Classes
    MLWriter
  37. final def sparkSession: SparkSession

    Returns the user-specified Spark Session or the default.

    Returns the user-specified Spark Session or the default.

    Attributes
    protected
    Definition Classes
    BaseReadWrite
  38. final def sqlContext: SQLContext

    Returns the user-specified SQL context or the default.

    Returns the user-specified SQL context or the default.

    Attributes
    protected
    Definition Classes
    BaseReadWrite
  39. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  40. def toString(): String
    Definition Classes
    AnyRef → Any
  41. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from MLWriter

Inherited from Logging

Inherited from BaseReadWrite

Inherited from AnyRef

Inherited from Any

Members