public class GBTClassifier extends ProbabilisticClassifier<Vector,GBTClassifier,GBTClassificationModel> implements DefaultParamsWritable, Logging
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]
Constructor and Description |
---|
GBTClassifier() |
GBTClassifier(String uid) |
Modifier and Type | Method and Description |
---|---|
static BooleanParam |
cacheNodeIds() |
static IntParam |
checkpointInterval() |
static Params |
clear(Param<?> param) |
GBTClassifier |
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) |
static Param<String> |
featuresCol() |
Param<String> |
featuresCol()
Param for features column name.
|
static M |
fit(Dataset<?> dataset) |
static M |
fit(Dataset<?> dataset,
ParamMap paramMap) |
static scala.collection.Seq<M> |
fit(Dataset<?> dataset,
ParamMap[] paramMaps) |
static M |
fit(Dataset<?> dataset,
ParamPair<?> firstParamPair,
ParamPair<?>... otherParamPairs) |
static M |
fit(Dataset<?> dataset,
ParamPair<?> firstParamPair,
scala.collection.Seq<ParamPair<?>> otherParamPairs) |
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() |
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 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 GBTClassifier |
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() |
static Param<?>[] |
params() |
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 void |
save(String path) |
static LongParam |
seed() |
static <T> Params |
set(Param<T> param,
T value) |
GBTClassifier |
setCacheNodeIds(boolean value) |
GBTClassifier |
setCheckpointInterval(int value)
Specifies how often to checkpoint the cached node IDs.
|
static Learner |
setFeaturesCol(String value) |
GBTClassifier |
setImpurity(String value)
The impurity setting is ignored for GBT models.
|
static Learner |
setLabelCol(String value) |
GBTClassifier |
setLossType(String value) |
GBTClassifier |
setMaxBins(int value) |
GBTClassifier |
setMaxDepth(int value) |
GBTClassifier |
setMaxIter(int value) |
GBTClassifier |
setMaxMemoryInMB(int value) |
GBTClassifier |
setMinInfoGain(double value) |
GBTClassifier |
setMinInstancesPerNode(int value) |
static Learner |
setPredictionCol(String value) |
static E |
setProbabilityCol(String value) |
static E |
setRawPredictionCol(String value) |
GBTClassifier |
setSeed(long value) |
GBTClassifier |
setStepSize(double value) |
GBTClassifier |
setSubsamplingRate(double value) |
static E |
setThresholds(double[] value) |
static DoubleParam |
stepSize() |
static DoubleParam |
subsamplingRate() |
static String[] |
supportedLossTypes()
Accessor for supported loss settings: logistic
|
static DoubleArrayParam |
thresholds() |
static String |
toString() |
static StructType |
transformSchema(StructType schema) |
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.
|
static MLWriter |
write() |
setProbabilityCol, setThresholds
setRawPredictionCol
fit, setFeaturesCol, setLabelCol, setPredictionCol, transformSchema
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
write
save
initializeLogging, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
toString
public GBTClassifier(String uid)
public GBTClassifier()
public static final String[] supportedLossTypes()
public static GBTClassifier load(String path)
public static String toString()
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 M fit(Dataset<?> dataset, ParamPair<?> firstParamPair, scala.collection.Seq<ParamPair<?>> otherParamPairs)
public static M fit(Dataset<?> dataset, ParamPair<?> firstParamPair, ParamPair<?>... otherParamPairs)
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 Learner setLabelCol(String value)
public static Learner setFeaturesCol(String value)
public static Learner setPredictionCol(String value)
public static M fit(Dataset<?> dataset)
public static StructType transformSchema(StructType schema)
public static final Param<String> rawPredictionCol()
public static final String getRawPredictionCol()
public static E 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 E setProbabilityCol(String value)
public static E 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 final int getMaxDepth()
public static final int getMaxBins()
public static final int getMinInstancesPerNode()
public static final double getMinInfoGain()
public static final int getMaxMemoryInMB()
public static final boolean getCacheNodeIds()
public static final DoubleParam subsamplingRate()
public static final double getSubsamplingRate()
public static final IntParam maxIter()
public static final int getMaxIter()
public static final DoubleParam stepSize()
public static final double getStepSize()
public static final Param<String> impurity()
public static final String getImpurity()
public static Param<String> lossType()
public static String getLossType()
public static void save(String path) throws java.io.IOException
java.io.IOException
public static MLWriter write()
public String uid()
Identifiable
uid
in interface Identifiable
public GBTClassifier setMaxDepth(int value)
public GBTClassifier setMaxBins(int value)
public GBTClassifier setMinInstancesPerNode(int value)
public GBTClassifier setMinInfoGain(double value)
public GBTClassifier setMaxMemoryInMB(int value)
public GBTClassifier setCacheNodeIds(boolean value)
public GBTClassifier setCheckpointInterval(int value)
SparkContext
.
Must be at least 1.
(default = 10)value
- (undocumented)public GBTClassifier setImpurity(String value)
value
- (undocumented)public GBTClassifier setSubsamplingRate(double value)
public GBTClassifier setSeed(long value)
public GBTClassifier setMaxIter(int value)
public GBTClassifier setStepSize(double value)
public GBTClassifier setLossType(String value)
public GBTClassifier copy(ParamMap extra)
Params
defaultCopy()
.copy
in interface Params
copy
in class Predictor<Vector,GBTClassifier,GBTClassificationModel>
extra
- (undocumented)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()