public class StochasticRidgeRegression extends Object implements Regressor, Parameterized, SingleWeightVectorModel
MultipleLinearRegression
with an added
L2 penalty for the weight vector. Constructor and Description |
---|
StochasticRidgeRegression(double lambda,
int epochs,
int batchSize,
double learningRate)
Creates a new stochastic Ridge Regression learner that does not use a
decay rate
|
StochasticRidgeRegression(double lambda,
int epochs,
int batchSize,
double learningRate,
DecayRate learningDecay)
Creates a new stochastic Ridge Regression learner
|
Modifier and Type | Method and Description |
---|---|
StochasticRidgeRegression |
clone() |
int |
getBatchSize()
Returns the batch size for updates
|
double |
getBias()
Returns the bias term used for the model, or 0 of the model does not
support or was not trained with a bias term.
|
double |
getBias(int index)
Returns the bias term used with the weight vector for the given class
index.
|
int |
getEpochs()
Returns the number of training iterations
|
double |
getLambda()
Returns the regularization constant in use
|
DecayRate |
getLearningDecay()
Returns the learning decay rate used
|
double |
getLearningRate()
Returns the learning rate in use.
|
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.
|
Vec |
getRawWeight()
Returns the only weight vector used for the model
|
Vec |
getRawWeight(int index)
Returns the raw weight vector associated with the given class index.
|
int |
numWeightsVecs()
Returns the number of weight vectors that can be returned.
|
double |
regress(DataPoint data) |
void |
setBatchSize(int batchSize)
Sets the batch size to learn from.
|
void |
setEpochs(int epochs)
Sets the number of iterations through the whole training set that will be
performed.
|
void |
setLambda(double lambda)
Sets the regularization parameter used.
|
void |
setLearningDecay(DecayRate learningDecay)
Sets the learning rate decay function to use.
|
void |
setLearningRate(double learningRate)
Sets the learning rate used, and should be in the range (0, 1).
|
boolean |
supportsWeightedData() |
void |
train(RegressionDataSet dataSet) |
void |
train(RegressionDataSet dataSet,
ExecutorService threadPool) |
public StochasticRidgeRegression(double lambda, int epochs, int batchSize, double learningRate)
lambda
- the regularization termepochs
- the number of training epochs to performbatchSize
- the batch size for updateslearningRate
- the learning ratepublic StochasticRidgeRegression(double lambda, int epochs, int batchSize, double learningRate, DecayRate learningDecay)
lambda
- the regularization termepochs
- the number of training epochs to performbatchSize
- the batch size for updateslearningRate
- the learning ratelearningDecay
- the learning rate decaypublic void setLambda(double lambda)
lambda
- the positive regularization constant in (0, Inf)public double getLambda()
public void setLearningRate(double learningRate)
learningRate
- the learning rate to usepublic double getLearningRate()
public void setLearningDecay(DecayRate learningDecay)
learningDecay
- the decay function to apply to the learning ratepublic DecayRate getLearningDecay()
public void setBatchSize(int batchSize)
batchSize
- the number of training points to use in each batch updatepublic int getBatchSize()
public void setEpochs(int epochs)
epochs
- the number of training iterationspublic int getEpochs()
public Vec getRawWeight()
SingleWeightVectorModel
getRawWeight
in interface SingleWeightVectorModel
public double getBias()
SingleWeightVectorModel
getBias
in interface SingleWeightVectorModel
public Vec getRawWeight(int index)
SimpleWeightVectorModel
ConstantVector
object may be returned. index = 0
should be usedgetRawWeight
in interface SimpleWeightVectorModel
index
- the class index to get the weight vector forpublic double getBias(int index)
SimpleWeightVectorModel
0
will be returned.index = 0
should be usedgetBias
in interface SimpleWeightVectorModel
index
- the class index to get the weight vector forpublic int numWeightsVecs()
SimpleWeightVectorModel
numWeightsVecs
in interface SimpleWeightVectorModel
SimpleWeightVectorModel.getRawWeight(int)
can be called.public void train(RegressionDataSet dataSet, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
public boolean supportsWeightedData()
supportsWeightedData
in interface Regressor
public StochasticRidgeRegression 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.