public class GBTClassificationModel extends ProbabilisticClassificationModel<Vector,GBTClassificationModel> implements MLWritable, scala.Serializable
param: _trees Decision trees in the ensemble. param: _treeWeights Weights for the decision trees in the ensemble.
Constructor and Description |
---|
GBTClassificationModel(String uid,
DecisionTreeRegressionModel[] _trees,
double[] _treeWeights)
Construct a GBTClassificationModel
|
Modifier and Type | Method and Description |
---|---|
static BooleanParam |
cacheNodeIds() |
static IntParam |
checkpointInterval() |
static Params |
clear(Param<?> param) |
GBTClassificationModel |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
static String |
explainParam(Param<?> param) |
static String |
explainParams() |
static ParamMap |
extractParamMap() |
static ParamMap |
extractParamMap(ParamMap extra) |
Vector |
featureImportances()
Estimate of the importance of each feature.
|
static Param<String> |
featuresCol() |
Param<String> |
featuresCol()
Param for features column name.
|
static <T> scala.Option<T> |
get(Param<T> param) |
static boolean |
getCacheNodeIds() |
static int |
getCheckpointInterval() |
static <T> scala.Option<T> |
getDefault(Param<T> param) |
static String |
getFeaturesCol() |
String |
getFeaturesCol() |
static String |
getImpurity() |
static String |
getLabelCol() |
String |
getLabelCol() |
static String |
getLossType() |
static int |
getMaxBins() |
static int |
getMaxDepth() |
static int |
getMaxIter() |
static int |
getMaxMemoryInMB() |
static double |
getMinInfoGain() |
static int |
getMinInstancesPerNode() |
int |
getNumTrees()
Number of trees in ensemble
|
static <T> T |
getOrDefault(Param<T> param) |
static Param<Object> |
getParam(String paramName) |
static String |
getPredictionCol() |
String |
getPredictionCol() |
static String |
getProbabilityCol() |
static String |
getRawPredictionCol() |
String |
getRawPredictionCol() |
static long |
getSeed() |
static double |
getStepSize() |
static double |
getSubsamplingRate() |
static double[] |
getThresholds() |
static <T> boolean |
hasDefault(Param<T> param) |
static boolean |
hasParam(String paramName) |
static boolean |
hasParent() |
static Param<String> |
impurity() |
static boolean |
isDefined(Param<?> param) |
static boolean |
isSet(Param<?> param) |
static Param<String> |
labelCol() |
Param<String> |
labelCol()
Param for label column name.
|
static GBTClassificationModel |
load(String path) |
static Param<String> |
lossType() |
static IntParam |
maxBins() |
static IntParam |
maxDepth() |
static IntParam |
maxIter() |
static IntParam |
maxMemoryInMB() |
static DoubleParam |
minInfoGain() |
static IntParam |
minInstancesPerNode() |
int |
numClasses() |
int |
numFeatures() |
int |
numTrees()
Number of trees in ensemble
|
static Param<?>[] |
params() |
static void |
parent_$eq(Estimator<M> x$1) |
static Estimator<M> |
parent() |
static Param<String> |
predictionCol() |
Param<String> |
predictionCol()
Param for prediction column name.
|
static Param<String> |
probabilityCol() |
static Param<String> |
rawPredictionCol() |
Param<String> |
rawPredictionCol()
Param for raw prediction (a.k.a.
|
static MLReader<GBTClassificationModel> |
read() |
static void |
save(String path) |
static LongParam |
seed() |
static <T> Params |
set(Param<T> param,
T value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setCacheNodeIds(boolean value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setCheckpointInterval(int value) |
static M |
setFeaturesCol(String value) |
static org.apache.spark.ml.tree.TreeClassifierParams |
setImpurity(String value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setMaxBins(int value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setMaxDepth(int value) |
static org.apache.spark.ml.tree.GBTParams |
setMaxIter(int value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setMaxMemoryInMB(int value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setMinInfoGain(double value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setMinInstancesPerNode(int value) |
static M |
setParent(Estimator<M> parent) |
static M |
setPredictionCol(String value) |
static M |
setProbabilityCol(String value) |
static M |
setRawPredictionCol(String value) |
static org.apache.spark.ml.tree.DecisionTreeParams |
setSeed(long value) |
static org.apache.spark.ml.tree.GBTParams |
setStepSize(double value) |
static org.apache.spark.ml.tree.TreeEnsembleParams |
setSubsamplingRate(double value) |
static M |
setThresholds(double[] value) |
static DoubleParam |
stepSize() |
static DoubleParam |
subsamplingRate() |
static DoubleArrayParam |
thresholds() |
static String |
toDebugString() |
String |
toString() |
static int |
totalNumNodes() |
static Dataset<Row> |
transform(Dataset<?> dataset) |
static Dataset<Row> |
transform(Dataset<?> dataset,
ParamMap paramMap) |
static Dataset<Row> |
transform(Dataset<?> dataset,
ParamPair<?> firstParamPair,
ParamPair<?>... otherParamPairs) |
static Dataset<Row> |
transform(Dataset<?> dataset,
ParamPair<?> firstParamPair,
scala.collection.Seq<ParamPair<?>> otherParamPairs) |
static StructType |
transformSchema(StructType schema) |
DecisionTreeRegressionModel[] |
trees() |
double[] |
treeWeights() |
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.
|
MLWriter |
write()
Returns an
MLWriter instance for this ML instance. |
normalizeToProbabilitiesInPlace, setProbabilityCol, setThresholds, transform
setRawPredictionCol
setFeaturesCol, setPredictionCol, transformSchema
transform, transform, transform
save
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
initializeLogging, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public GBTClassificationModel(String uid, DecisionTreeRegressionModel[] _trees, double[] _treeWeights)
_trees
- Decision trees in the ensemble._treeWeights
- Weights for the decision trees in the ensemble.uid
- (undocumented)public static MLReader<GBTClassificationModel> read()
public static GBTClassificationModel load(String path)
public static Param<?>[] params()
public static String explainParam(Param<?> param)
public static String explainParams()
public static final boolean isSet(Param<?> param)
public static final boolean isDefined(Param<?> param)
public static boolean hasParam(String paramName)
public static Param<Object> getParam(String paramName)
public static final <T> scala.Option<T> get(Param<T> param)
public static final <T> T getOrDefault(Param<T> param)
public static final <T> scala.Option<T> getDefault(Param<T> param)
public static final <T> boolean hasDefault(Param<T> param)
public static final ParamMap extractParamMap()
public static Dataset<Row> transform(Dataset<?> dataset, ParamPair<?> firstParamPair, scala.collection.Seq<ParamPair<?>> otherParamPairs)
public static Dataset<Row> transform(Dataset<?> dataset, ParamPair<?> firstParamPair, ParamPair<?>... otherParamPairs)
public static Estimator<M> parent()
public static void parent_$eq(Estimator<M> x$1)
public static M setParent(Estimator<M> parent)
public static boolean hasParent()
public static final Param<String> labelCol()
public static final String getLabelCol()
public static final Param<String> featuresCol()
public static final String getFeaturesCol()
public static final Param<String> predictionCol()
public static final String getPredictionCol()
public static M setFeaturesCol(String value)
public static M setPredictionCol(String value)
public static StructType transformSchema(StructType schema)
public static final Param<String> rawPredictionCol()
public static final String getRawPredictionCol()
public static M setRawPredictionCol(String value)
public static final Param<String> probabilityCol()
public static final String getProbabilityCol()
public static final DoubleArrayParam thresholds()
public static double[] getThresholds()
public static M setProbabilityCol(String value)
public static M setThresholds(double[] value)
public static final IntParam checkpointInterval()
public static final int getCheckpointInterval()
public static final LongParam seed()
public static final long getSeed()
public static final IntParam maxDepth()
public static final IntParam maxBins()
public static final IntParam minInstancesPerNode()
public static final DoubleParam minInfoGain()
public static final IntParam maxMemoryInMB()
public static final BooleanParam cacheNodeIds()
public static org.apache.spark.ml.tree.DecisionTreeParams setMaxDepth(int value)
public static final int getMaxDepth()
public static org.apache.spark.ml.tree.DecisionTreeParams setMaxBins(int value)
public static final int getMaxBins()
public static org.apache.spark.ml.tree.DecisionTreeParams setMinInstancesPerNode(int value)
public static final int getMinInstancesPerNode()
public static org.apache.spark.ml.tree.DecisionTreeParams setMinInfoGain(double value)
public static final double getMinInfoGain()
public static org.apache.spark.ml.tree.DecisionTreeParams setSeed(long value)
public static org.apache.spark.ml.tree.DecisionTreeParams setMaxMemoryInMB(int value)
public static final int getMaxMemoryInMB()
public static org.apache.spark.ml.tree.DecisionTreeParams setCacheNodeIds(boolean value)
public static final boolean getCacheNodeIds()
public static org.apache.spark.ml.tree.DecisionTreeParams setCheckpointInterval(int value)
public static final DoubleParam subsamplingRate()
public static org.apache.spark.ml.tree.TreeEnsembleParams setSubsamplingRate(double value)
public static final double getSubsamplingRate()
public static final IntParam maxIter()
public static final int getMaxIter()
public static org.apache.spark.ml.tree.GBTParams setMaxIter(int value)
public static final DoubleParam stepSize()
public static final double getStepSize()
public static org.apache.spark.ml.tree.GBTParams setStepSize(double value)
public static final Param<String> impurity()
public static org.apache.spark.ml.tree.TreeClassifierParams setImpurity(String value)
public static final String getImpurity()
public static Param<String> lossType()
public static String getLossType()
public static String toDebugString()
public static int totalNumNodes()
public static void save(String path) throws java.io.IOException
java.io.IOException
public String uid()
Identifiable
uid
in interface Identifiable
uid
in class ProbabilisticClassificationModel<Vector,GBTClassificationModel>
public int numFeatures()
numFeatures
in class ProbabilisticClassificationModel<Vector,GBTClassificationModel>
public int numClasses()
numClasses
in class ProbabilisticClassificationModel<Vector,GBTClassificationModel>
public DecisionTreeRegressionModel[] trees()
public int getNumTrees()
public double[] treeWeights()
public int numTrees()
public GBTClassificationModel copy(ParamMap extra)
Params
defaultCopy()
.copy
in interface Params
copy
in class ProbabilisticClassificationModel<Vector,GBTClassificationModel>
extra
- (undocumented)public String toString()
toString
in interface Identifiable
toString
in class ProbabilisticClassificationModel<Vector,GBTClassificationModel>
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.
See DecisionTreeClassificationModel.featureImportances
public MLWriter write()
MLWritable
MLWriter
instance for this ML instance.write
in interface MLWritable
public StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
public Param<String> rawPredictionCol()
public 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<String> labelCol()
public String getLabelCol()
public Param<String> featuresCol()
public String getFeaturesCol()
public Param<String> predictionCol()
public String getPredictionCol()