public final class DecisionTreeClassifier extends ProbabilisticClassifier<Vector,DecisionTreeClassifier,DecisionTreeClassificationModel>
Decision tree
learning algorithm
for classification.
It supports both binary and multiclass labels, as well as both continuous and categorical
features.Constructor and Description |
---|
DecisionTreeClassifier() |
DecisionTreeClassifier(java.lang.String uid) |
Modifier and Type | Method and Description |
---|---|
DecisionTreeClassifier |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
Param<java.lang.String> |
featuresCol()
Param for features column name.
|
java.lang.String |
getFeaturesCol() |
java.lang.String |
getLabelCol() |
java.lang.String |
getPredictionCol() |
java.lang.String |
getRawPredictionCol() |
Param<java.lang.String> |
labelCol()
Param for label column name.
|
Param<java.lang.String> |
predictionCol()
Param for prediction column name.
|
Param<java.lang.String> |
rawPredictionCol()
Param for raw prediction (a.k.a.
|
DecisionTreeClassifier |
setCacheNodeIds(boolean value) |
DecisionTreeClassifier |
setCheckpointInterval(int value) |
DecisionTreeClassifier |
setImpurity(java.lang.String value) |
DecisionTreeClassifier |
setMaxBins(int value) |
DecisionTreeClassifier |
setMaxDepth(int value) |
DecisionTreeClassifier |
setMaxMemoryInMB(int value) |
DecisionTreeClassifier |
setMinInfoGain(double value) |
DecisionTreeClassifier |
setMinInstancesPerNode(int value) |
DecisionTreeClassifier |
setSeed(long value) |
static java.lang.String[] |
supportedImpurities()
Accessor for supported impurities: entropy, gini
|
protected DecisionTreeClassificationModel |
train(DataFrame dataset)
Train a model using the given dataset and parameters.
|
java.lang.String |
uid()
An immutable unique ID for the object and its derivatives.
|
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType) |
StructType |
validateAndTransformSchema(StructType schema,
boolean fitting,
DataType featuresDataType)
Validates and transforms the input schema with the provided param map.
|
setProbabilityCol, setThresholds
setRawPredictionCol
extractLabeledPoints, fit, setFeaturesCol, setLabelCol, setPredictionCol, transformSchema
transformSchema
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn, validateParams
toString
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public DecisionTreeClassifier(java.lang.String uid)
public DecisionTreeClassifier()
public static final java.lang.String[] supportedImpurities()
public java.lang.String uid()
Identifiable
public DecisionTreeClassifier setMaxDepth(int value)
public DecisionTreeClassifier setMaxBins(int value)
public DecisionTreeClassifier setMinInstancesPerNode(int value)
public DecisionTreeClassifier setMinInfoGain(double value)
public DecisionTreeClassifier setMaxMemoryInMB(int value)
public DecisionTreeClassifier setCacheNodeIds(boolean value)
public DecisionTreeClassifier setCheckpointInterval(int value)
public DecisionTreeClassifier setImpurity(java.lang.String value)
public DecisionTreeClassifier setSeed(long value)
protected DecisionTreeClassificationModel train(DataFrame dataset)
Predictor
fit()
to avoid dealing with schema validation
and copying parameters into the model.
train
in class Predictor<Vector,DecisionTreeClassifier,DecisionTreeClassificationModel>
dataset
- Training datasetpublic DecisionTreeClassifier copy(ParamMap extra)
Params
copy
in interface Params
copy
in class Predictor<Vector,DecisionTreeClassifier,DecisionTreeClassificationModel>
extra
- (undocumented)defaultCopy()
public StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
public Param<java.lang.String> rawPredictionCol()
public java.lang.String getRawPredictionCol()
public StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
schema
- input schemafitting
- whether this is in fittingfeaturesDataType
- SQL DataType for FeaturesType.
E.g., VectorUDT
for vector features.public Param<java.lang.String> labelCol()
public java.lang.String getLabelCol()
public Param<java.lang.String> featuresCol()
public java.lang.String getFeaturesCol()
public Param<java.lang.String> predictionCol()
public java.lang.String getPredictionCol()