public class DecisionTreeClassificationModel extends ProbabilisticClassificationModel<Vector,DecisionTreeClassificationModel> implements DecisionTreeModel, DecisionTreeClassifierParams, MLWritable, scala.Serializable
| Modifier and Type | Method and Description |
|---|---|
DecisionTreeClassificationModel |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
Vector |
featureImportances()
Estimate of the importance of each feature.
|
static DecisionTreeClassificationModel |
load(String path) |
int |
numClasses()
Number of classes (values which the label can take).
|
int |
numFeatures()
Returns the number of features the model was trained on.
|
double |
predict(Vector features)
Predict label for the given features.
|
static MLReader<DecisionTreeClassificationModel> |
read() |
Node |
rootNode()
Root of the decision tree
|
String |
toString()
Summary of the model
|
String |
uid()
An immutable unique ID for the object and its derivatives.
|
MLWriter |
write()
Returns an
MLWriter instance for this ML instance. |
normalizeToProbabilitiesInPlace, setProbabilityCol, setThresholds, transformsetRawPredictionColsetFeaturesCol, setPredictionCol, transformSchematransform, transform, transformdepth, maxSplitFeatureIndex, numNodes, toDebugStringcacheNodeIds, getCacheNodeIds, getMaxBins, getMaxDepth, getMaxMemoryInMB, getMinInfoGain, getMinInstancesPerNode, getOldStrategy, maxBins, maxDepth, maxMemoryInMB, minInfoGain, minInstancesPerNode, setCacheNodeIds, setCheckpointInterval, setMaxBins, setMaxDepth, setMaxMemoryInMB, setMinInfoGain, setMinInstancesPerNode, setSeedvalidateAndTransformSchemagetLabelCol, labelColfeaturesCol, getFeaturesColgetPredictionCol, predictionColclear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwncheckpointInterval, getCheckpointIntervalgetImpurity, getOldImpurity, impurity, setImpuritysavevalidateAndTransformSchemagetRawPredictionCol, rawPredictionColgetProbabilityCol, probabilityColgetThresholds, thresholdsinitializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarningpublic static MLReader<DecisionTreeClassificationModel> read()
public static DecisionTreeClassificationModel load(String path)
public String uid()
Identifiableuid in interface Identifiablepublic Node rootNode()
DecisionTreeModelrootNode in interface DecisionTreeModelpublic int numFeatures()
PredictionModelnumFeatures in class PredictionModel<Vector,DecisionTreeClassificationModel>public int numClasses()
ClassificationModelnumClasses in class ClassificationModel<Vector,DecisionTreeClassificationModel>public double predict(Vector features)
ClassificationModeltransform() and output predictionCol.
This default implementation for classification predicts the index of the maximum value
from predictRaw().
predict in class ClassificationModel<Vector,DecisionTreeClassificationModel>features - (undocumented)public DecisionTreeClassificationModel copy(ParamMap extra)
ParamsdefaultCopy().copy in interface Paramscopy in class Model<DecisionTreeClassificationModel>extra - (undocumented)public String toString()
DecisionTreeModeltoString in interface DecisionTreeModeltoString in interface IdentifiabletoString in class Objectpublic Vector featureImportances()
This generalizes the idea of "Gini" importance to other losses, following the explanation of Gini importance from "Random Forests" documentation by Leo Breiman and Adele Cutler, and following the implementation from scikit-learn.
This feature importance is calculated as follows: - importance(feature j) = sum (over nodes which split on feature j) of the gain, where gain is scaled by the number of instances passing through node - Normalize importances for tree to sum to 1.
RandomForestClassifier
to determine feature importance instead.public MLWriter write()
MLWritableMLWriter instance for this ML instance.write in interface MLWritable