Class GBTClassifier
Object
org.apache.spark.ml.PipelineStage
org.apache.spark.ml.Estimator<M>
org.apache.spark.ml.Predictor<FeaturesType,E,M>
org.apache.spark.ml.classification.Classifier<FeaturesType,E,M>
org.apache.spark.ml.classification.ProbabilisticClassifier<Vector,GBTClassifier,GBTClassificationModel>
org.apache.spark.ml.classification.GBTClassifier
- All Implemented Interfaces:
Serializable,org.apache.spark.internal.Logging,org.apache.spark.ml.classification.ClassifierParams,org.apache.spark.ml.classification.ProbabilisticClassifierParams,Params,HasCheckpointInterval,HasFeaturesCol,HasLabelCol,HasMaxIter,HasPredictionCol,HasProbabilityCol,HasRawPredictionCol,HasSeed,HasStepSize,HasThresholds,HasValidationIndicatorCol,HasWeightCol,org.apache.spark.ml.PredictorParams,org.apache.spark.ml.tree.DecisionTreeParams,org.apache.spark.ml.tree.GBTClassifierParams,org.apache.spark.ml.tree.GBTParams,org.apache.spark.ml.tree.HasVarianceImpurity,org.apache.spark.ml.tree.TreeEnsembleClassifierParams,org.apache.spark.ml.tree.TreeEnsembleParams,DefaultParamsWritable,Identifiable,MLWritable
public class GBTClassifier
extends ProbabilisticClassifier<Vector,GBTClassifier,GBTClassificationModel>
implements org.apache.spark.ml.tree.GBTClassifierParams, DefaultParamsWritable, org.apache.spark.internal.Logging
Gradient-Boosted Trees (GBTs) (http://en.wikipedia.org/wiki/Gradient_boosting)
learning algorithm for classification.
It supports binary labels, as well as both continuous and categorical features.
The implementation is based upon: J.H. Friedman. "Stochastic Gradient Boosting." 1999.
Notes on Gradient Boosting vs. TreeBoost: - This implementation is for Stochastic Gradient Boosting, not for TreeBoost. - Both algorithms learn tree ensembles by minimizing loss functions. - TreeBoost (Friedman, 1999) additionally modifies the outputs at tree leaf nodes based on the loss function, whereas the original gradient boosting method does not. - We expect to implement TreeBoost in the future: [https://issues.apache.org/jira/browse/SPARK-4240]
- See Also:
- Note:
- Multiclass labels are not currently supported.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.spark.internal.Logging
org.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal BooleanParamfinal IntParamParam for set checkpoint interval (>= 1) or disable checkpoint (-1).Creates a copy of this instance with the same UID and some extra params.impurity()leafCol()static GBTClassifierlossType()final IntParammaxBins()final IntParammaxDepth()final IntParammaxIter()Param for maximum number of iterations (>= 0).final IntParamfinal DoubleParamfinal IntParamfinal DoubleParamstatic MLReader<T>read()final LongParamseed()Param for random seed.setCacheNodeIds(boolean value) setCheckpointInterval(int value) Specifies how often to checkpoint the cached node IDs.setFeatureSubsetStrategy(String value) setImpurity(String value) The impurity setting is ignored for GBT models.setLossType(String value) setMaxBins(int value) setMaxDepth(int value) setMaxIter(int value) setMaxMemoryInMB(int value) setMinInfoGain(double value) setMinInstancesPerNode(int value) setMinWeightFractionPerNode(double value) setSeed(long value) setStepSize(double value) setSubsamplingRate(double value) setValidationIndicatorCol(String value) setWeightCol(String value) Sets the value of paramweightCol().final DoubleParamstepSize()Param for Step size to be used for each iteration of optimization (> 0).final DoubleParamstatic final String[]Accessor for supported loss settings: logisticuid()An immutable unique ID for the object and its derivatives.Param for name of the column that indicates whether each row is for training or for validation.final DoubleParamParam for weight column name.Methods inherited from class org.apache.spark.ml.classification.ProbabilisticClassifier
probabilityCol, setProbabilityCol, setThresholds, thresholdsMethods inherited from class org.apache.spark.ml.classification.Classifier
rawPredictionCol, setRawPredictionColMethods inherited from class org.apache.spark.ml.Predictor
featuresCol, fit, labelCol, predictionCol, setFeaturesCol, setLabelCol, setPredictionCol, transformSchemaMethods inherited from class org.apache.spark.ml.PipelineStage
paramsMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.spark.ml.tree.DecisionTreeParams
getCacheNodeIds, getLeafCol, getMaxBins, getMaxDepth, getMaxMemoryInMB, getMinInfoGain, getMinInstancesPerNode, getMinWeightFractionPerNode, getOldStrategy, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$cacheNodeIds_$eq, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$leafCol_$eq, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$maxBins_$eq, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$maxDepth_$eq, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$maxMemoryInMB_$eq, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$minInfoGain_$eq, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$minInstancesPerNode_$eq, org$apache$spark$ml$tree$DecisionTreeParams$_setter_$minWeightFractionPerNode_$eq, setLeafColMethods inherited from interface org.apache.spark.ml.util.DefaultParamsWritable
writeMethods inherited from interface org.apache.spark.ml.tree.GBTClassifierParams
getLossType, getOldLossType, org$apache$spark$ml$tree$GBTClassifierParams$_setter_$lossType_$eqMethods inherited from interface org.apache.spark.ml.tree.GBTParams
getOldBoostingStrategy, getValidationTol, org$apache$spark$ml$tree$GBTParams$_setter_$stepSize_$eq, org$apache$spark$ml$tree$GBTParams$_setter_$validationTol_$eqMethods inherited from interface org.apache.spark.ml.param.shared.HasCheckpointInterval
getCheckpointIntervalMethods inherited from interface org.apache.spark.ml.param.shared.HasFeaturesCol
featuresCol, getFeaturesColMethods inherited from interface org.apache.spark.ml.param.shared.HasLabelCol
getLabelCol, labelColMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxIter
getMaxIterMethods inherited from interface org.apache.spark.ml.param.shared.HasPredictionCol
getPredictionCol, predictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasProbabilityCol
getProbabilityCol, probabilityColMethods inherited from interface org.apache.spark.ml.param.shared.HasRawPredictionCol
getRawPredictionCol, rawPredictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasStepSize
getStepSizeMethods inherited from interface org.apache.spark.ml.param.shared.HasThresholds
getThresholds, thresholdsMethods inherited from interface org.apache.spark.ml.param.shared.HasValidationIndicatorCol
getValidationIndicatorColMethods inherited from interface org.apache.spark.ml.tree.HasVarianceImpurity
getImpurity, getOldImpurity, org$apache$spark$ml$tree$HasVarianceImpurity$_setter_$impurity_$eqMethods inherited from interface org.apache.spark.ml.param.shared.HasWeightCol
getWeightColMethods inherited from interface org.apache.spark.ml.util.Identifiable
toStringMethods inherited from interface org.apache.spark.internal.Logging
initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logBasedOnLevel, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, MDC, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContextMethods inherited from interface org.apache.spark.ml.util.MLWritable
saveMethods inherited from interface org.apache.spark.ml.param.Params
clear, copyValues, defaultCopy, defaultParamMap, estimateMatadataSize, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwnMethods inherited from interface org.apache.spark.ml.tree.TreeEnsembleClassifierParams
validateAndTransformSchemaMethods inherited from interface org.apache.spark.ml.tree.TreeEnsembleParams
getFeatureSubsetStrategy, getOldStrategy, getSubsamplingRate, org$apache$spark$ml$tree$TreeEnsembleParams$_setter_$featureSubsetStrategy_$eq, org$apache$spark$ml$tree$TreeEnsembleParams$_setter_$subsamplingRate_$eq
-
Constructor Details
-
GBTClassifier
-
GBTClassifier
public GBTClassifier()
-
-
Method Details
-
supportedLossTypes
Accessor for supported loss settings: logistic -
load
-
read
-
lossType
- Specified by:
lossTypein interfaceorg.apache.spark.ml.tree.GBTClassifierParams
-
impurity
- Specified by:
impurityin interfaceorg.apache.spark.ml.tree.HasVarianceImpurity
-
validationTol
- Specified by:
validationTolin interfaceorg.apache.spark.ml.tree.GBTParams
-
stepSize
Description copied from interface:HasStepSizeParam for Step size to be used for each iteration of optimization (> 0).- Specified by:
stepSizein interfaceorg.apache.spark.ml.tree.GBTParams- Specified by:
stepSizein interfaceHasStepSize- Returns:
- (undocumented)
-
validationIndicatorCol
Description copied from interface:HasValidationIndicatorColParam for name of the column that indicates whether each row is for training or for validation. False indicates training; true indicates validation..- Specified by:
validationIndicatorColin interfaceHasValidationIndicatorCol- Returns:
- (undocumented)
-
maxIter
Description copied from interface:HasMaxIterParam for maximum number of iterations (>= 0).- Specified by:
maxIterin interfaceHasMaxIter- Returns:
- (undocumented)
-
subsamplingRate
- Specified by:
subsamplingRatein interfaceorg.apache.spark.ml.tree.TreeEnsembleParams
-
featureSubsetStrategy
- Specified by:
featureSubsetStrategyin interfaceorg.apache.spark.ml.tree.TreeEnsembleParams
-
leafCol
- Specified by:
leafColin interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
maxDepth
- Specified by:
maxDepthin interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
maxBins
- Specified by:
maxBinsin interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
minInstancesPerNode
- Specified by:
minInstancesPerNodein interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
minWeightFractionPerNode
- Specified by:
minWeightFractionPerNodein interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
minInfoGain
- Specified by:
minInfoGainin interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
maxMemoryInMB
- Specified by:
maxMemoryInMBin interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
cacheNodeIds
- Specified by:
cacheNodeIdsin interfaceorg.apache.spark.ml.tree.DecisionTreeParams
-
weightCol
Description copied from interface:HasWeightColParam for weight column name. If this is not set or empty, we treat all instance weights as 1.0.- Specified by:
weightColin interfaceHasWeightCol- Returns:
- (undocumented)
-
seed
Description copied from interface:HasSeedParam for random seed. -
checkpointInterval
Description copied from interface:HasCheckpointIntervalParam for set checkpoint interval (>= 1) or disable checkpoint (-1). E.g. 10 means that the cache will get checkpointed every 10 iterations. Note: this setting will be ignored if the checkpoint directory is not set in the SparkContext.- Specified by:
checkpointIntervalin interfaceHasCheckpointInterval- Returns:
- (undocumented)
-
uid
Description copied from interface:IdentifiableAn immutable unique ID for the object and its derivatives.- Specified by:
uidin interfaceIdentifiable- Returns:
- (undocumented)
-
setMaxDepth
-
setMaxBins
-
setMinInstancesPerNode
-
setMinWeightFractionPerNode
-
setMinInfoGain
-
setMaxMemoryInMB
-
setCacheNodeIds
-
setCheckpointInterval
Specifies how often to checkpoint the cached node IDs. E.g. 10 means that the cache will get checkpointed every 10 iterations. This is only used if cacheNodeIds is true and if the checkpoint directory is set inSparkContext. Must be at least 1. (default = 10)- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
setImpurity
The impurity setting is ignored for GBT models. Individual trees are built using impurity "Variance."- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
setSubsamplingRate
-
setSeed
-
setMaxIter
-
setStepSize
-
setFeatureSubsetStrategy
-
setLossType
-
setValidationIndicatorCol
-
setWeightCol
Sets the value of paramweightCol(). If this is not set or empty, we treat all instance weights as 1.0. By default the weightCol is not set, so all instances have weight 1.0.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
copy
Description copied from interface:ParamsCreates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly. SeedefaultCopy().- Specified by:
copyin interfaceParams- Specified by:
copyin classPredictor<Vector,GBTClassifier, GBTClassificationModel> - Parameters:
extra- (undocumented)- Returns:
- (undocumented)
-