org.apache.spark.mllib.tree.loss
Interface Loss

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbsoluteError, LogLoss, SquaredError

public interface Loss
extends scala.Serializable

:: DeveloperApi :: Trait for adding "pluggable" loss functions for the gradient boosting algorithm.


Method Summary
 double computeError(double prediction, double label)
          Method to calculate loss when the predictions are already known.
 double computeError(org.apache.spark.mllib.tree.model.TreeEnsembleModel model, RDD<LabeledPoint> data)
          Method to calculate error of the base learner for the gradient boosting calculation.
 double gradient(double prediction, double label)
          Method to calculate the gradients for the gradient boosting calculation.
 

Method Detail

gradient

double gradient(double prediction,
                double label)
Method to calculate the gradients for the gradient boosting calculation.

Parameters:
prediction - Predicted feature
label - true label.
Returns:
Loss gradient.

computeError

double computeError(org.apache.spark.mllib.tree.model.TreeEnsembleModel model,
                    RDD<LabeledPoint> data)
Method to calculate error of the base learner for the gradient boosting calculation. Note: This method is not used by the gradient boosting algorithm but is useful for debugging purposes.

Parameters:
model - Model of the weak learner.
data - Training dataset: RDD of LabeledPoint.
Returns:
Measure of model error on data

computeError

double computeError(double prediction,
                    double label)
Method to calculate loss when the predictions are already known. Note: This method is used in the method evaluateEachIteration to avoid recomputing the predicted values from previously fit trees.

Parameters:
prediction - Predicted label.
label - True label.
Returns:
Measure of model error on datapoint.