org.apache.spark.mllib.tree.loss
Class AbsoluteError

Object
  extended by org.apache.spark.mllib.tree.loss.AbsoluteError
All Implemented Interfaces:
java.io.Serializable, Loss

public class AbsoluteError
extends Object
implements Loss

:: DeveloperApi :: Class for absolute error loss calculation (for regression).

The absolute (L1) error is defined as: |y - F(x)| where y is the label and F(x) is the model prediction for features x.

See Also:
Serialized Form

Constructor Summary
AbsoluteError()
           
 
Method Summary
static double gradient(double prediction, double label)
          Method to calculate the gradients for the gradient boosting calculation for least absolute error calculation.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.spark.mllib.tree.loss.Loss
computeError, computeError, gradient
 

Constructor Detail

AbsoluteError

public AbsoluteError()
Method Detail

gradient

public static double gradient(double prediction,
                              double label)
Method to calculate the gradients for the gradient boosting calculation for least absolute error calculation. The gradient with respect to F(x) is: sign(F(x) - y)

Parameters:
prediction - Predicted label.
label - True label.
Returns:
Loss gradient