public class LassoWithSGD extends GeneralizedLinearAlgorithm<LassoModel> implements scala.Serializable
Constructor and Description |
---|
LassoWithSGD()
Deprecated.
Use ml.regression.LinearRegression with elasticNetParam = 1.0. Note the default regParam is 0.01 for LassoWithSGD, but is 0.0 for LinearRegression. Since 2.0.0.
|
Modifier and Type | Method and Description |
---|---|
static int |
getNumFeatures() |
static boolean |
isAddIntercept() |
GradientDescent |
optimizer()
The optimizer to solve the problem.
|
static M |
run(RDD<LabeledPoint> input) |
static M |
run(RDD<LabeledPoint> input,
Vector initialWeights) |
static GeneralizedLinearAlgorithm<M> |
setIntercept(boolean addIntercept) |
static GeneralizedLinearAlgorithm<M> |
setValidateData(boolean validateData) |
static LassoModel |
train(RDD<LabeledPoint> input,
int numIterations)
Train a Lasso model given an RDD of (label, features) pairs.
|
static LassoModel |
train(RDD<LabeledPoint> input,
int numIterations,
double stepSize,
double regParam)
Train a Lasso model given an RDD of (label, features) pairs.
|
static LassoModel |
train(RDD<LabeledPoint> input,
int numIterations,
double stepSize,
double regParam,
double miniBatchFraction)
Train a Lasso model given an RDD of (label, features) pairs.
|
static LassoModel |
train(RDD<LabeledPoint> input,
int numIterations,
double stepSize,
double regParam,
double miniBatchFraction,
Vector initialWeights)
Train a Lasso model given an RDD of (label, features) pairs.
|
getNumFeatures, isAddIntercept, run, run, setIntercept, setValidateData
public LassoWithSGD()
public static LassoModel train(RDD<LabeledPoint> input, int numIterations, double stepSize, double regParam, double miniBatchFraction, Vector initialWeights)
miniBatchFraction
fraction of the data to calculate a stochastic gradient. The weights used
in gradient descent are initialized using the initial weights provided.
input
- RDD of (label, array of features) pairs. Each pair describes a row of the data
matrix A as well as the corresponding right hand side label ynumIterations
- Number of iterations of gradient descent to run.stepSize
- Step size scaling to be used for the iterations of gradient descent.regParam
- Regularization parameter.miniBatchFraction
- Fraction of data to be used per iteration.initialWeights
- Initial set of weights to be used. Array should be equal in size to
the number of features in the data.
public static LassoModel train(RDD<LabeledPoint> input, int numIterations, double stepSize, double regParam, double miniBatchFraction)
miniBatchFraction
fraction of the data to calculate a stochastic gradient.
input
- RDD of (label, array of features) pairs. Each pair describes a row of the data
matrix A as well as the corresponding right hand side label ynumIterations
- Number of iterations of gradient descent to run.stepSize
- Step size to be used for each iteration of gradient descent.regParam
- Regularization parameter.miniBatchFraction
- Fraction of data to be used per iteration.
public static LassoModel train(RDD<LabeledPoint> input, int numIterations, double stepSize, double regParam)
input
- RDD of (label, array of features) pairs. Each pair describes a row of the data
matrix A as well as the corresponding right hand side label ystepSize
- Step size to be used for each iteration of Gradient Descent.regParam
- Regularization parameter.numIterations
- Number of iterations of gradient descent to run.public static LassoModel train(RDD<LabeledPoint> input, int numIterations)
input
- RDD of (label, array of features) pairs. Each pair describes a row of the data
matrix A as well as the corresponding right hand side label ynumIterations
- Number of iterations of gradient descent to run.public static int getNumFeatures()
public static boolean isAddIntercept()
public static GeneralizedLinearAlgorithm<M> setIntercept(boolean addIntercept)
public static GeneralizedLinearAlgorithm<M> setValidateData(boolean validateData)
public static M run(RDD<LabeledPoint> input)
public static M run(RDD<LabeledPoint> input, Vector initialWeights)
public GradientDescent optimizer()
GeneralizedLinearAlgorithm
optimizer
in class GeneralizedLinearAlgorithm<LassoModel>