|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.apache.spark.mllib.optimization.Gradient org.apache.spark.mllib.optimization.HingeGradient
public class HingeGradient
:: DeveloperApi :: Compute gradient and loss for a Hinge loss function, as used in SVM binary classification. See also the documentation for the precise formulation. NOTE: This assumes that the labels are {0,1}
Constructor Summary | |
---|---|
HingeGradient()
|
Method Summary | |
---|---|
scala.Tuple2<Vector,Object> |
compute(Vector data,
double label,
Vector weights)
Compute the gradient and loss given the features of a single data point. |
double |
compute(Vector data,
double label,
Vector weights,
Vector cumGradient)
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. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HingeGradient()
Method Detail |
---|
public scala.Tuple2<Vector,Object> compute(Vector data, double label, Vector weights)
Gradient
compute
in class Gradient
data
- features for one data pointlabel
- label for this data pointweights
- weights/coefficients corresponding to features
public double compute(Vector data, double label, Vector weights, Vector cumGradient)
Gradient
compute
in class Gradient
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |