Huber-loss for for robust regression. More...
#include <shark/ObjectiveFunctions/Loss/HuberLoss.h>
Public Member Functions | |
HuberLoss (double delta=1.0) | |
constructor More... | |
std::string | name () const |
Returns class name "HuberLoss". More... | |
double | eval (BatchLabelType const &labels, BatchOutputType const &predictions) const |
calculates the sum of all More... | |
double | evalDerivative (BatchLabelType const &labels, BatchOutputType const &predictions, BatchOutputType &gradient) const |
evaluate the loss and the derivative w.r.t. the prediction More... | |
Public Member Functions inherited from shark::AbstractLoss< RealVector, RealVector > | |
AbstractLoss () | |
virtual double | eval (ConstLabelReference target, ConstOutputReference prediction) const |
evaluate the loss for a target and a prediction More... | |
double | eval (Data< LabelType > const &targets, Data< OutputType > const &predictions) const |
virtual double | evalDerivative (ConstLabelReference target, ConstOutputReference prediction, OutputType &gradient) const |
evaluate the loss and its derivative for a target and a prediction More... | |
virtual double | evalDerivative (ConstLabelReference target, ConstOutputReference prediction, OutputType &gradient, MatrixType &hessian) const |
evaluate the loss and its first and second derivative for a target and a prediction More... | |
double | operator() (LabelType const &target, OutputType const &prediction) const |
evaluate the loss for a target and a prediction More... | |
double | operator() (BatchLabelType const &target, BatchOutputType const &prediction) const |
Public Member Functions inherited from shark::AbstractCost< RealVector, RealVector > | |
virtual | ~AbstractCost () |
const Features & | features () const |
virtual void | updateFeatures () |
bool | hasFirstDerivative () const |
returns true when the first parameter derivative is implemented More... | |
bool | isLossFunction () const |
returns true when the cost function is in fact a loss function More... | |
double | operator() (Data< LabelType > const &targets, Data< OutputType > const &predictions) const |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Huber-loss for for robust regression.
The Huber loss is a function that is quadratic if \( ||f(x)-y||_2 \leq \delta \). Outside this region, whn the error is larger, it is defined as a linear continuation. The function is once but not twice differentiable. This loss is important for regression as it weights outliers lower than ordinary least squares regression while still preserving a convex shape of the loss function.
Please not that, due to its nature, the error function is not scale invariant. thus rescaling the dataset changes the behaviour. This function has the hyper parameter delta which marks thee region where the function changes from quadratic to linear.
Definition at line 48 of file HuberLoss.h.
|
inline |
constructor
Definition at line 52 of file HuberLoss.h.
References shark::AbstractCost< RealVector, RealVector >::m_features.
|
inlinevirtual |
calculates the sum of all
Implements shark::AbstractLoss< RealVector, RealVector >.
Definition at line 62 of file HuberLoss.h.
References SIZE_CHECK.
|
inlinevirtual |
evaluate the loss and the derivative w.r.t. the prediction
target | target value |
prediction | prediction, typically made by a model |
gradient | the gradient of the loss function with respect to the prediction |
Reimplemented from shark::AbstractLoss< RealVector, RealVector >.
Definition at line 82 of file HuberLoss.h.
References SIZE_CHECK.
|
inlinevirtual |
Returns class name "HuberLoss".
Reimplemented from shark::INameable.
Definition at line 57 of file HuberLoss.h.