Packages

class TrainClassifier extends Estimator[TrainedClassifierModel] with AutoTrainer[TrainedClassifierModel] with BasicLogging

Trains a classification model. Featurizes the given data into a vector of doubles.

Note the behavior of the reindex and labels parameters, the parameters interact as:

reindex -> false labels -> false (Empty) Assume all double values, don't use metadata, assume natural ordering

reindex -> true labels -> false (Empty) Index, use natural ordering of string indexer

reindex -> false labels -> true (Specified) Assume user knows indexing, apply label values. Currently only string type supported.

reindex -> true labels -> true (Specified) Validate labels matches column type, try to recast to label type, reindex label column

The currently supported classifiers are: Logistic Regression Classifier Decision Tree Classifier Random Forest Classifier Gradient Boosted Trees Classifier Naive Bayes Classifier Multilayer Perceptron Classifier In addition to any generic learner that inherits from Predictor.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TrainClassifier
  2. BasicLogging
  3. AutoTrainer
  4. Wrappable
  5. RWrappable
  6. PythonWrappable
  7. BaseWrappable
  8. HasFeaturesCol
  9. ComplexParamsWritable
  10. MLWritable
  11. HasLabelCol
  12. Estimator
  13. PipelineStage
  14. Logging
  15. Params
  16. Serializable
  17. Serializable
  18. Identifiable
  19. AnyRef
  20. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TrainClassifier()
  2. new TrainClassifier(uid: String)

Value Members

  1. final def clear(param: Param[_]): TrainClassifier.this.type
    Definition Classes
    Params
  2. def convertLabel(dataset: Dataset[_], labelColumn: String, labelValues: Option[Array[_]]): (DataFrame, Option[Array[_]])
  3. def copy(extra: ParamMap): Estimator[TrainedClassifierModel]
    Definition Classes
    TrainClassifier → Estimator → PipelineStage → Params
  4. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  5. def explainParams(): String
    Definition Classes
    Params
  6. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  7. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  8. val featuresCol: Param[String]

    The name of the features column

    The name of the features column

    Definition Classes
    HasFeaturesCol
  9. def fit(dataset: Dataset[_]): TrainedClassifierModel

    Fits the classification model.

    Fits the classification model.

    dataset

    The input dataset to train.

    returns

    The trained classification model.

    Definition Classes
    TrainClassifier → Estimator
  10. def fit(dataset: Dataset[_], paramMaps: Seq[ParamMap]): Seq[TrainedClassifierModel]
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  11. def fit(dataset: Dataset[_], paramMap: ParamMap): TrainedClassifierModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  12. def fit(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): TrainedClassifierModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" ) @varargs()
  13. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  14. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  15. def getFeaturesCol: String

    Definition Classes
    HasFeaturesCol
  16. def getFeaturizeParams: (Boolean, Boolean, Int)
  17. def getLabelCol: String

    Definition Classes
    HasLabelCol
  18. def getLabels: Array[String]

  19. def getModel: Estimator[_ <: Model[_]]

    Definition Classes
    AutoTrainer
  20. def getNumFeatures: Int

    Definition Classes
    AutoTrainer
  21. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  22. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  23. def getReindexLabel: Boolean

  24. final def hasDefault[T](param: Param[T]): Boolean
    Definition Classes
    Params
  25. def hasParam(paramName: String): Boolean
    Definition Classes
    Params
  26. final def isDefined(param: Param[_]): Boolean
    Definition Classes
    Params
  27. final def isSet(param: Param[_]): Boolean
    Definition Classes
    Params
  28. val labelCol: Param[String]

    The name of the label column

    The name of the label column

    Definition Classes
    HasLabelCol
  29. val labels: StringArrayParam

    Specifies the labels metadata on the column.

    Specifies the labels metadata on the column. See class documentation for how this parameter interacts with reindex labels parameter.

  30. def logClass(): Unit
    Definition Classes
    BasicLogging
  31. def logFit[T](f: ⇒ T): T
    Definition Classes
    BasicLogging
  32. def logPredict[T](f: ⇒ T): T
    Definition Classes
    BasicLogging
  33. def logTrain[T](f: ⇒ T): T
    Definition Classes
    BasicLogging
  34. def logTransform[T](f: ⇒ T): T
    Definition Classes
    BasicLogging
  35. def logVerb[T](verb: String, f: ⇒ T): T
    Definition Classes
    BasicLogging
  36. def makePyFile(conf: CodegenConfig): Unit
    Definition Classes
    PythonWrappable
  37. def makeRFile(conf: CodegenConfig): Unit
    Definition Classes
    RWrappable
  38. val model: EstimatorParam

    Model to run.

    Model to run. See doc on derived classes.

    Definition Classes
    AutoTrainer
  39. def modelDoc: String

    Doc for model to run.

    Doc for model to run.

    Definition Classes
    TrainClassifierAutoTrainer
  40. val numFeatures: IntParam

    Number of features to hash to

    Number of features to hash to

    Definition Classes
    AutoTrainer
  41. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  42. def pyAdditionalMethods: String
    Definition Classes
    PythonWrappable
  43. def pyInitFunc(): String
    Definition Classes
    PythonWrappable
  44. val reindexLabel: BooleanParam

    Specifies whether to reindex the given label column.

    Specifies whether to reindex the given label column. See class documentation for how this parameter interacts with specified labels.

  45. def save(path: String): Unit
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  46. final def set[T](param: Param[T], value: T): TrainClassifier.this.type
    Definition Classes
    Params
  47. def setFeaturesCol(value: String): TrainClassifier.this.type

    Definition Classes
    HasFeaturesCol
  48. def setLabelCol(value: String): TrainClassifier.this.type

    Definition Classes
    HasLabelCol
  49. def setLabels(value: Array[String]): TrainClassifier.this.type

  50. def setModel(value: Estimator[_ <: Model[_]]): TrainClassifier.this.type

    Definition Classes
    AutoTrainer
  51. def setNumFeatures(value: Int): TrainClassifier.this.type

    Definition Classes
    AutoTrainer
  52. def setReindexLabel(value: Boolean): TrainClassifier.this.type

  53. def toString(): String
    Definition Classes
    Identifiable → AnyRef → Any
  54. def transformSchema(schema: StructType): StructType
    Definition Classes
    TrainClassifier → PipelineStage
    Annotations
    @DeveloperApi()
  55. val uid: String
    Definition Classes
    TrainClassifierBasicLogging → Identifiable
  56. val ver: String
    Definition Classes
    BasicLogging
  57. def write: MLWriter
    Definition Classes
    ComplexParamsWritable → MLWritable