Class LeastSquaresGradient
Object
org.apache.spark.mllib.optimization.Gradient
org.apache.spark.mllib.optimization.LeastSquaresGradient
- All Implemented Interfaces:
Serializable
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.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCompute the gradient and loss given the features of a single data point.double
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.
-
Constructor Details
-
LeastSquaresGradient
public LeastSquaresGradient()
-
-
Method Details
-
compute
Description copied from class:Gradient
Compute the gradient and loss given the features of a single data point. -
compute
Description copied from class:Gradient
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.
-