public class RandomForestClassificationModel extends ProbabilisticClassificationModel<Vector,RandomForestClassificationModel> implements RandomForestClassifierParams, TreeEnsembleModel<DecisionTreeClassificationModel>, MLWritable, scala.Serializable
param: _trees Decision trees in the ensemble. Warning: These have null parents.
Modifier and Type | Method and Description |
---|---|
RandomForestClassificationModel |
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 RandomForestClassificationModel |
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.
|
static MLReader<RandomForestClassificationModel> |
read() |
String |
toString()
Summary of the model
|
DecisionTreeClassificationModel[] |
trees()
Trees in this ensemble.
|
double[] |
treeWeights()
Weights for each tree, zippable with
trees |
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, transform
predict, setRawPredictionCol
setFeaturesCol, setPredictionCol, transformSchema
transform, transform, transform
getNumTrees, numTrees, setNumTrees
featureSubsetStrategy, getFeatureSubsetStrategy, getOldStrategy, getSubsamplingRate, setFeatureSubsetStrategy, setSubsamplingRate, subsamplingRate
cacheNodeIds, getCacheNodeIds, getMaxBins, getMaxDepth, getMaxMemoryInMB, getMinInfoGain, getMinInstancesPerNode, getOldStrategy, maxBins, maxDepth, maxMemoryInMB, minInfoGain, minInstancesPerNode, setCacheNodeIds, setCheckpointInterval, setMaxBins, setMaxDepth, setMaxMemoryInMB, setMinInfoGain, setMinInstancesPerNode, setSeed
validateAndTransformSchema
getLabelCol, labelCol
featuresCol, getFeaturesCol
getPredictionCol, predictionCol
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
checkpointInterval, getCheckpointInterval
getImpurity, getOldImpurity, impurity, setImpurity
javaTreeWeights, toDebugString, totalNumNodes
save
validateAndTransformSchema
getRawPredictionCol, rawPredictionCol
getProbabilityCol, probabilityCol
getThresholds, thresholds
initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public static MLReader<RandomForestClassificationModel> read()
public static RandomForestClassificationModel load(String path)
public String uid()
Identifiable
uid
in interface Identifiable
public int numFeatures()
PredictionModel
numFeatures
in class PredictionModel<Vector,RandomForestClassificationModel>
public int numClasses()
ClassificationModel
numClasses
in class ClassificationModel<Vector,RandomForestClassificationModel>
public DecisionTreeClassificationModel[] trees()
TreeEnsembleModel
trees
in interface TreeEnsembleModel<DecisionTreeClassificationModel>
public double[] treeWeights()
TreeEnsembleModel
trees
treeWeights
in interface TreeEnsembleModel<DecisionTreeClassificationModel>
public RandomForestClassificationModel copy(ParamMap extra)
Params
defaultCopy()
.copy
in interface Params
copy
in class Model<RandomForestClassificationModel>
extra
- (undocumented)public String toString()
TreeEnsembleModel
toString
in interface TreeEnsembleModel<DecisionTreeClassificationModel>
toString
in interface Identifiable
toString
in class Object
public Vector featureImportances()
Each feature's importance is the average of its importance across all trees in the ensemble The importance vector is normalized to sum to 1. This method is suggested by Hastie et al. (Hastie, Tibshirani, Friedman. "The Elements of Statistical Learning, 2nd Edition." 2001.) and follows the implementation from scikit-learn.
DecisionTreeClassificationModel.featureImportances
public MLWriter write()
MLWritable
MLWriter
instance for this ML instance.write
in interface MLWritable