public class StochasticGradientBoosting extends Object implements Regressor, Parameterized
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_LEARNING_RATE
The default value for the
setLearningRate(double) is
0.1 |
static double |
DEFAULT_TRAINING_PROPORTION
The default value for the
training proportion is
0.5. |
Constructor and Description |
---|
StochasticGradientBoosting(Regressor weakLearner,
int maxIterations)
Creates a new SGB learner that is initialized using the weak learner.
|
StochasticGradientBoosting(Regressor weakLearner,
int maxIterations,
double learningRate)
Creates a new SGB learner that is initialized using the weak learner.
|
StochasticGradientBoosting(Regressor weakLearner,
int maxIterations,
double learningRate,
double trainingPortion)
Creates a new SGB learner that is initialized using the weak learner.
|
StochasticGradientBoosting(Regressor strongLearner,
Regressor weakLearner,
int maxIterations,
double learningRate,
double trainingPortion)
Creates a new initialized SGB learner.
|
Modifier and Type | Method and Description |
---|---|
StochasticGradientBoosting |
clone() |
double |
getLearningRate()
Returns the learning rate of the algorithm used to control overfitting.
|
int |
getMaxIterations()
Returns the maximum number of iterations used in SGB
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
double |
getTrainingProportion()
Returns the fraction of the data points used during each iteration of the
training algorithm.
|
double |
regress(DataPoint data) |
void |
setLearningRate(double learningRate)
Sets the learning rate of the algorithm.
|
void |
setMaxIterations(int maxIterations)
Sets the maximum number of iterations used in SGB.
|
void |
setTrainingProportion(double trainingProportion)
The GB version uses the whole data set at each iteration.
|
boolean |
supportsWeightedData() |
void |
train(RegressionDataSet dataSet) |
void |
train(RegressionDataSet dataSet,
ExecutorService threadPool) |
public static final double DEFAULT_TRAINING_PROPORTION
training proportion
is
0.5.public static final double DEFAULT_LEARNING_RATE
setLearningRate(double)
is
0.1public StochasticGradientBoosting(Regressor strongLearner, Regressor weakLearner, int maxIterations, double learningRate, double trainingPortion)
strongLearner
- the powerful learner to refine with weak learnersweakLearner
- the weak learner to fit to the residuals in each iterationmaxIterations
- the maximum number of algorithm iterations to performlearningRate
- the multiplier to apply to the weak learnerstrainingPortion
- the proportion of the data set to use for each iteration of learningpublic StochasticGradientBoosting(Regressor weakLearner, int maxIterations, double learningRate, double trainingPortion)
weakLearner
- the weak learner to fit to the residuals in each iterationmaxIterations
- the maximum number of algorithm iterations to performlearningRate
- the multiplier to apply to the weak learnerstrainingPortion
- the proportion of the data set to use for each iteration of learningpublic StochasticGradientBoosting(Regressor weakLearner, int maxIterations, double learningRate)
weakLearner
- the weak learner to fit to the residuals in each iterationmaxIterations
- the maximum number of algorithm iterations to performlearningRate
- the multiplier to apply to the weak learnerspublic StochasticGradientBoosting(Regressor weakLearner, int maxIterations)
weakLearner
- the weak learner to fit to the residuals in each iterationmaxIterations
- the maximum number of algorithm iterations to performpublic void setMaxIterations(int maxIterations)
maxIterations
- the maximum number of algorithm iterations to performpublic int getMaxIterations()
public void setLearningRate(double learningRate)
learningRate
- the multiplier to apply to the weak learnersArithmeticException
- if the learning rate is not in the range (0, 1]public double getLearningRate()
public void setTrainingProportion(double trainingProportion)
trainingProportion
- the fraction of training the data set to use
for each iteration of SGBArithmeticException
- if the trainingPortion is not a valid
fraction in (0, 1]public double getTrainingProportion()
public void train(RegressionDataSet dataSet, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
public boolean supportsWeightedData()
supportsWeightedData
in interface Regressor
public StochasticGradientBoosting clone()
public List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainCopyright © 2017. All rights reserved.