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. DotnetWrappable
  6. RWrappable
  7. PythonWrappable
  8. BaseWrappable
  9. HasFeaturesCol
  10. ComplexParamsWritable
  11. MLWritable
  12. HasLabelCol
  13. Estimator
  14. PipelineStage
  15. Logging
  16. Params
  17. Serializable
  18. Serializable
  19. Identifiable
  20. AnyRef
  21. 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 dotnetAdditionalMethods: String
    Definition Classes
    DotnetWrappable
  5. def explainParam(param: Param[_]): String
    Definition Classes
    Params
  6. def explainParams(): String
    Definition Classes
    Params
  7. final def extractParamMap(): ParamMap
    Definition Classes
    Params
  8. final def extractParamMap(extra: ParamMap): ParamMap
    Definition Classes
    Params
  9. val featuresCol: Param[String]

    The name of the features column

    The name of the features column

    Definition Classes
    HasFeaturesCol
  10. 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
  11. def fit(dataset: Dataset[_], paramMaps: Seq[ParamMap]): Seq[TrainedClassifierModel]
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  12. def fit(dataset: Dataset[_], paramMap: ParamMap): TrainedClassifierModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  13. def fit(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): TrainedClassifierModel
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" ) @varargs()
  14. final def get[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  15. final def getDefault[T](param: Param[T]): Option[T]
    Definition Classes
    Params
  16. def getFeaturesCol: String

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

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

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

    Definition Classes
    AutoTrainer
  21. def getNumFeatures: Int

    Definition Classes
    AutoTrainer
  22. final def getOrDefault[T](param: Param[T]): T
    Definition Classes
    Params
  23. def getParam(paramName: String): Param[Any]
    Definition Classes
    Params
  24. def getParamInfo(p: Param[_]): ParamInfo[_]
    Definition Classes
    BaseWrappable
  25. def getReindexLabel: Boolean

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

    The name of the label column

    The name of the label column

    Definition Classes
    HasLabelCol
  31. 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.

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

    Model to run.

    Model to run. See doc on derived classes.

    Definition Classes
    AutoTrainer
  42. def modelDoc: String

    Doc for model to run.

    Doc for model to run.

    Definition Classes
    TrainClassifierAutoTrainer
  43. val numFeatures: IntParam

    Number of features to hash to

    Number of features to hash to

    Definition Classes
    AutoTrainer
  44. lazy val params: Array[Param[_]]
    Definition Classes
    Params
  45. def pyAdditionalMethods: String
    Definition Classes
    PythonWrappable
  46. def pyInitFunc(): String
    Definition Classes
    PythonWrappable
  47. 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.

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

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

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

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

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

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

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