Class Gradient
Object
org.apache.spark.mllib.optimization.Gradient
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- HingeGradient,- LeastSquaresGradient,- LogisticGradient
Class used to compute the gradient for a loss function, given a single data point.
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionCompute the gradient and loss given the features of a single data point.abstract doubleCompute 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- 
Gradientpublic Gradient()
 
- 
- 
Method Details- 
computeCompute the gradient and loss given the features of a single data point.- Parameters:
- data- features for one data point
- label- label for this data point
- weights- weights/coefficients corresponding to features
- Returns:
- (gradient: Vector, loss: Double)
 
- 
computeCompute 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.- Parameters:
- data- features for one data point
- label- label for this data point
- weights- weights/coefficients corresponding to features
- cumGradient- the computed gradient will be added to this vector
- Returns:
- loss
 
 
-