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 Summary
Constructors - 
Method Summary
Modifier 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
- 
Gradient
public Gradient() 
 - 
 - 
Method Details
- 
compute
Compute the gradient and loss given the features of a single data point.- Parameters:
 data- features for one data pointlabel- label for this data pointweights- weights/coefficients corresponding to features- Returns:
 - (gradient: Vector, loss: Double)
 
 - 
compute
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.- Parameters:
 data- features for one data pointlabel- label for this data pointweights- weights/coefficients corresponding to featurescumGradient- the computed gradient will be added to this vector- Returns:
 - loss
 
 
 -