Hinge-loss for large margin regression using th squared two-norm. More...
#include <shark/ObjectiveFunctions/Loss/SquaredEpsilonHingeLoss.h>
Public Member Functions | |
SquaredEpsilonHingeLoss (double epsilon) | |
constructor | |
std::string | name () const |
Returns class name "HingeLoss". | |
double | eval (BatchLabelType const &labels, BatchOutputType const &predictions) const |
calculates the sum of all | |
double | evalDerivative (BatchLabelType const &labels, BatchOutputType const &predictions, BatchOutputType &gradient) const |
evaluate the loss and the derivative w.r.t. the prediction | |
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 | |
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 | |
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 | |
double | operator() (LabelType const &target, OutputType const &prediction) const |
evaluate the loss for a target and a prediction | |
double | operator() (BatchLabelType const &target, BatchOutputType const &prediction) const |
Public Member Functions inherited from shark::AbstractCost< LabelT, OutputT > | |
virtual | ~AbstractCost () |
const Features & | features () const |
virtual void | updateFeatures () |
bool | hasFirstDerivative () const |
returns true when the first parameter derivative is implemented | |
bool | isLossFunction () const |
returns true when the cost function is in fact a loss function | |
virtual double | eval (Data< LabelType > const &targets, Data< OutputType > const &predictions) const =0 |
double | operator() (Data< LabelType > const &targets, Data< OutputType > const &predictions) const |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Hinge-loss for large margin regression using th squared two-norm.
The loss is defined as \(L_i = 1/2 \max\{0.0, ||f(x_i)-y{i,j}||^2- \epsilon^2\} \)
where \( y_i =(y_{i,1},\dots,y_{i_N} \) is the label of dimension N and \( f_j(x_i) \) is the j-th output of the prediction of the model for the ith input. The loss introduces the concept of a margin to regression, that is, points are not punished when they are sufficiently close to the function.
epsilon describes the distance from the label to the margin that is allowed until the point leaves the margin.
Contrary to th EpsilonHingeLoss, this loss is differentiable.
Definition at line 52 of file SquaredEpsilonHingeLoss.h.
|
inline |
constructor
Definition at line 56 of file SquaredEpsilonHingeLoss.h.
References shark::AbstractCost< LabelT, OutputT >::m_features.
|
inlinevirtual |
calculates the sum of all
Implements shark::AbstractLoss< RealVector, RealVector >.
Definition at line 66 of file SquaredEpsilonHingeLoss.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 73 of file SquaredEpsilonHingeLoss.h.
References SIZE_CHECK.
|
inlinevirtual |
Returns class name "HingeLoss".
Reimplemented from shark::INameable.
Definition at line 61 of file SquaredEpsilonHingeLoss.h.