Class/Object

com.microsoft.ml.spark

TrainClassifier

Related Docs: object TrainClassifier | package spark

Permalink

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

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.

Annotations
@InternalWrapper()
Linear Supertypes
AutoTrainer[TrainedClassifierModel], HasFeaturesCol, ComplexParamsWritable, MLWritable, HasLabelCol, Wrappable, Estimator[TrainedClassifierModel], PipelineStage, org.apache.spark.internal.Logging, Params, Serializable, Serializable, Identifiable, AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. TrainClassifier
  2. AutoTrainer
  3. HasFeaturesCol
  4. ComplexParamsWritable
  5. MLWritable
  6. HasLabelCol
  7. Wrappable
  8. Estimator
  9. PipelineStage
  10. Logging
  11. Params
  12. Serializable
  13. Serializable
  14. Identifiable
  15. AnyRef
  16. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TrainClassifier()

    Permalink
  2. new TrainClassifier(uid: String)

    Permalink

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 $[T](param: Param[T]): T

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  4. final def ==(arg0: Any): Boolean

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

    Permalink
    Definition Classes
    Any
  6. final def clear(param: Param[_]): TrainClassifier.this.type

    Permalink
    Definition Classes
    Params
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def convertLabel(dataset: Dataset[_], labelColumn: String, labelValues: Option[Array[_]]): (DataFrame, Option[Array[_]])

    Permalink
  9. def copy(extra: ParamMap): Estimator[TrainedClassifierModel]

    Permalink
    Definition Classes
    TrainClassifier → Estimator → PipelineStage → Params
  10. def copyValues[T <: Params](to: T, extra: ParamMap): T

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  11. final def defaultCopy[T <: Params](extra: ParamMap): T

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  12. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  14. def explainParam(param: Param[_]): String

    Permalink
    Definition Classes
    Params
  15. def explainParams(): String

    Permalink
    Definition Classes
    Params
  16. final def extractParamMap(): ParamMap

    Permalink
    Definition Classes
    Params
  17. final def extractParamMap(extra: ParamMap): ParamMap

    Permalink
    Definition Classes
    Params
  18. val featuresCol: Param[String]

    Permalink

    The name of the features column

    The name of the features column

    Definition Classes
    HasFeaturesCol
  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def fit(dataset: Dataset[_]): TrainedClassifierModel

    Permalink

    Fits the classification model.

    Fits the classification model.

    dataset

    The input dataset to train.

    returns

    The trained classification model.

    Definition Classes
    TrainClassifier → Estimator
  21. def fit(dataset: Dataset[_], paramMaps: Array[ParamMap]): Seq[TrainedClassifierModel]

    Permalink
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  22. def fit(dataset: Dataset[_], paramMap: ParamMap): TrainedClassifierModel

    Permalink
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" )
  23. def fit(dataset: Dataset[_], firstParamPair: ParamPair[_], otherParamPairs: ParamPair[_]*): TrainedClassifierModel

    Permalink
    Definition Classes
    Estimator
    Annotations
    @Since( "2.0.0" ) @varargs()
  24. final def get[T](param: Param[T]): Option[T]

    Permalink
    Definition Classes
    Params
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def getDefault[T](param: Param[T]): Option[T]

    Permalink
    Definition Classes
    Params
  27. def getFeaturesCol: String

    Permalink

    Definition Classes
    HasFeaturesCol
  28. def getFeaturizeParams: (Boolean, Boolean, Int)

    Permalink
  29. def getLabelCol: String

    Permalink

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

    Permalink

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

    Permalink

    Definition Classes
    AutoTrainer
  32. def getNumFeatures: Int

    Permalink

    Definition Classes
    AutoTrainer
  33. final def getOrDefault[T](param: Param[T]): T

    Permalink
    Definition Classes
    Params
  34. def getParam(paramName: String): Param[Any]

    Permalink
    Definition Classes
    Params
  35. def getReindexLabel: Boolean

    Permalink

  36. final def hasDefault[T](param: Param[T]): Boolean

    Permalink
    Definition Classes
    Params
  37. def hasParam(paramName: String): Boolean

    Permalink
    Definition Classes
    Params
  38. def hashCode(): Int

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

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

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  41. final def isDefined(param: Param[_]): Boolean

    Permalink
    Definition Classes
    Params
  42. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  43. final def isSet(param: Param[_]): Boolean

    Permalink
    Definition Classes
    Params
  44. def isTraceEnabled(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  45. val labelCol: Param[String]

    Permalink

    The name of the label column

    The name of the label column

    Definition Classes
    HasLabelCol
  46. val labels: StringArrayParam

    Permalink

    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.

  47. def log: Logger

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

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

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

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

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

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

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

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

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

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

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

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  59. val model: EstimatorParam

    Permalink

    Model to run.

    Model to run. See doc on derived classes.

    Definition Classes
    AutoTrainer
  60. def modelDoc: String

    Permalink

    Doc for model to run.

    Doc for model to run.

    Definition Classes
    TrainClassifierAutoTrainer
  61. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  62. final def notify(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  64. val numFeatures: IntParam

    Permalink

    Number of features to hash to

    Number of features to hash to

    Definition Classes
    AutoTrainer
  65. lazy val params: Array[Param[_]]

    Permalink
    Definition Classes
    Params
  66. val reindexLabel: BooleanParam

    Permalink

    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.

  67. def save(path: String): Unit

    Permalink
    Definition Classes
    MLWritable
    Annotations
    @Since( "1.6.0" ) @throws( ... )
  68. final def set(paramPair: ParamPair[_]): TrainClassifier.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  69. final def set(param: String, value: Any): TrainClassifier.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  70. final def set[T](param: Param[T], value: T): TrainClassifier.this.type

    Permalink
    Definition Classes
    Params
  71. final def setDefault(paramPairs: ParamPair[_]*): TrainClassifier.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  72. final def setDefault[T](param: Param[T], value: T): TrainClassifier.this.type

    Permalink
    Attributes
    protected
    Definition Classes
    Params
  73. def setFeaturesCol(value: String): TrainClassifier.this.type

    Permalink

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

    Permalink

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

    Permalink

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

    Permalink

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

    Permalink

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

    Permalink

  79. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    Identifiable → AnyRef → Any
  81. def transformSchema(schema: StructType): StructType

    Permalink
    Definition Classes
    TrainClassifier → PipelineStage
    Annotations
    @DeveloperApi()
  82. def transformSchema(schema: StructType, logging: Boolean): StructType

    Permalink
    Attributes
    protected
    Definition Classes
    PipelineStage
    Annotations
    @DeveloperApi()
  83. val uid: String

    Permalink
    Definition Classes
    TrainClassifier → Identifiable
  84. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  87. def write: MLWriter

    Permalink
    Definition Classes
    ComplexParamsWritable → MLWritable

Inherited from HasFeaturesCol

Inherited from ComplexParamsWritable

Inherited from MLWritable

Inherited from HasLabelCol

Inherited from Wrappable

Inherited from Estimator[TrainedClassifierModel]

Inherited from PipelineStage

Inherited from org.apache.spark.internal.Logging

Inherited from Params

Inherited from Serializable

Inherited from Serializable

Inherited from Identifiable

Inherited from AnyRef

Inherited from Any

Parameters

A list of parameter keys this algorithm can take. Users can set and get the parameter values through setters and getters

Parameter setters

Parameter getters

Members