Class: LinearRegressionWithSGD

eclairjs/mllib/regression.LinearRegressionWithSGD

Train a linear regression model with no regularization using Stochastic Gradient Descent. This solves the least squares regression formulation f(weights) = 1/n ||A weights-y||^2^ (which is the mean squared error). Here the data matrix has n rows, and the input RDD holds the set of rows of A, each with its corresponding right hand side label y. See also the documentation for the precise formulation.

Constructor

new LinearRegressionWithSGD()

Construct a LinearRegression object with default parameters: {stepSize: 1.0, numIterations: 100, miniBatchFraction: 1.0}.
Source:

Methods

(static) train(rdd, numIterations, stepSizeopt, miniBatchFractionopt, initialWeightsopt) → {module:eclairjs/mllib/regression.LinearRegressionModel}

Train a Linear Regression model given an RDD of (label, features) pairs. We run a fixed number of iterations of gradient descent using the specified step size. Each iteration uses miniBatchFraction fraction of the data to calculate a stochastic gradient. The weights used in gradient descent are initialized using the initial weights provided.
Parameters:
Name Type Attributes Description
rdd module:eclairjs/rdd.RDD of LabeledPoints1
numIterations integer
stepSize float <optional>
step size to be used for each iteration of gradient descent, defaults to 1.0
miniBatchFraction floar <optional>
fraction of data to be used per iteration, defaults to 1.0
initialWeights Vactor <optional>
initial set of weights to be used. Array should be equal in size to the number of features in the data.
Source:
Returns:
Type
module:eclairjs/mllib/regression.LinearRegressionModel