public final class SparseExample extends Object implements Example
Constructor and Description |
---|
SparseExample(double label,
float[] values,
int[] indices) |
Modifier and Type | Method and Description |
---|---|
void |
addGradient(Vector gradientVector,
double gradient)
Adds the current example's gradient to the gradientVector, assuming that
the gradient with respect to the prediction is gradient.
|
int |
getFeatureLength() |
double |
getLabel()
Access to the label.
|
double |
predict(Vector w)
Computes the prediction for this Example, given the model w.
|
public SparseExample(double label, float[] values, int[] indices)
public int getFeatureLength()
public double predict(Vector w)
Example
w.dot(this.getFeatures())
public void addGradient(Vector gradientVector, double gradient)
Example
addGradient
in interface Example
Copyright © 2016 The Apache Software Foundation. All rights reserved.