public class StreamingLinearRegressionWithSGD extends StreamingLinearAlgorithm<LinearRegressionModel,LinearRegressionWithSGD> implements scala.Serializable
LinearRegressionWithSGD
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 linear regression analysis in an application, like:
val model = new StreamingLinearRegressionWithSGD() .setStepSize(0.5) .setNumIterations(10) .setInitialWeights(Vectors.dense(...)) .trainOn(DStream)
Constructor and Description |
---|
StreamingLinearRegressionWithSGD()
Construct a StreamingLinearRegression object with default parameters:
{stepSize: 0.1, numIterations: 50, miniBatchFraction: 1.0}.
|
Modifier and Type | Method and Description |
---|---|
LinearRegressionWithSGD |
algorithm()
The algorithm to use for updating.
|
StreamingLinearRegressionWithSGD |
setConvergenceTol(double tolerance)
Set the convergence tolerance.
|
StreamingLinearRegressionWithSGD |
setInitialWeights(Vector initialWeights)
Set the initial weights.
|
StreamingLinearRegressionWithSGD |
setMiniBatchFraction(double miniBatchFraction)
Set the fraction of each batch to use for updates.
|
StreamingLinearRegressionWithSGD |
setNumIterations(int numIterations)
Set the number of iterations of gradient descent to run per update.
|
StreamingLinearRegressionWithSGD |
setRegParam(double regParam)
Set the regularization parameter.
|
StreamingLinearRegressionWithSGD |
setStepSize(double stepSize)
Set the step size for gradient descent.
|
latestModel, predictOn, predictOn, predictOnValues, predictOnValues, trainOn, trainOn
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeLogging, initializeLogIfNecessary, initializeLogIfNecessary, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public StreamingLinearRegressionWithSGD()
StreamingLinearAlgorithm
)public LinearRegressionWithSGD algorithm()
StreamingLinearAlgorithm
public StreamingLinearRegressionWithSGD setStepSize(double stepSize)
stepSize
- (undocumented)public StreamingLinearRegressionWithSGD setRegParam(double regParam)
regParam
- (undocumented)public StreamingLinearRegressionWithSGD setNumIterations(int numIterations)
numIterations
- (undocumented)public StreamingLinearRegressionWithSGD setMiniBatchFraction(double miniBatchFraction)
miniBatchFraction
- (undocumented)public StreamingLinearRegressionWithSGD setInitialWeights(Vector initialWeights)
initialWeights
- (undocumented)public StreamingLinearRegressionWithSGD setConvergenceTol(double tolerance)
tolerance
- (undocumented)