public class StreamingLogisticRegressionWithSGD extends StreamingLinearAlgorithm<LogisticRegressionModel,LogisticRegressionWithSGD> implements scala.Serializable
LogisticRegressionWithSGD
for model equation)
Each batch of data is assumed to be an RDD of LabeledPoints. The number of data points per batch can vary, but the number of features must be constant. An initial weight vector must be provided.
Use a builder pattern to construct a streaming logistic regression analysis in an application, like:
val model = new StreamingLogisticRegressionWithSGD()
.setStepSize(0.5)
.setNumIterations(10)
.setInitialWeights(Vectors.dense(...))
.trainOn(DStream)
Constructor and Description |
---|
StreamingLogisticRegressionWithSGD()
Construct a StreamingLogisticRegression object with default parameters:
{stepSize: 0.1, numIterations: 50, miniBatchFraction: 1.0, regParam: 0.0}.
|
Modifier and Type | Method and Description |
---|---|
StreamingLogisticRegressionWithSGD |
setInitialWeights(Vector initialWeights)
Set the initial weights.
|
StreamingLogisticRegressionWithSGD |
setMiniBatchFraction(double miniBatchFraction)
Set the fraction of each batch to use for updates.
|
StreamingLogisticRegressionWithSGD |
setNumIterations(int numIterations)
Set the number of iterations of gradient descent to run per update.
|
StreamingLogisticRegressionWithSGD |
setRegParam(double regParam)
Set the regularization parameter.
|
StreamingLogisticRegressionWithSGD |
setStepSize(double stepSize)
Set the step size for gradient descent.
|
latestModel, predictOn, predictOn, predictOnValues, predictOnValues, trainOn, trainOn
public StreamingLogisticRegressionWithSGD()
StreamingLinearAlgorithm
)public StreamingLogisticRegressionWithSGD setStepSize(double stepSize)
public StreamingLogisticRegressionWithSGD setNumIterations(int numIterations)
public StreamingLogisticRegressionWithSGD setMiniBatchFraction(double miniBatchFraction)
public StreamingLogisticRegressionWithSGD setRegParam(double regParam)
public StreamingLogisticRegressionWithSGD setInitialWeights(Vector initialWeights)