org.apache.spark.mllib.optimization
Compute the gradient and loss given the features of a single data point, add the gradient to a provided vector to avoid creating new objects, and return loss.
Compute the gradient and loss given the features of a single data point, add the gradient to a provided vector to avoid creating new objects, and return loss.
features for one data point
label for this data point
weights/coefficients corresponding to features
the computed gradient will be added to this vector
loss
Compute the gradient and loss given the features of a single data point.
Compute the gradient and loss given the features of a single data point.
features for one data point
label for this data point
weights/coefficients corresponding to features
(gradient: Vector, loss: Double)
:: DeveloperApi :: Compute gradient and loss for a Least-squared loss function, as used in linear regression. This is correct for the averaged least squares loss function (mean squared error) L = 1/2n ||A weights-y||^2 See also the documentation for the precise formulation.