Hinge-loss for large margin regression. More...
#include <shark/ObjectiveFunctions/Loss/EpsilonHingeLoss.h>
Inheritance diagram for shark::EpsilonHingeLoss:Public Member Functions | |
| EpsilonHingeLoss (double epsilon) | |
| constructor More... | |
| std::string | name () const |
| Returns class name "HingeLoss". 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 (LabelType const &target, OutputType const &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 (LabelType const &target, OutputType const &prediction, OutputType &gradient) const |
| evaluate the loss and its derivative for a target and a prediction More... | |
| virtual double | evalDerivative (LabelType const &target, OutputType const &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 () |
Additional Inherited Members | |
Public Types inherited from shark::AbstractLoss< RealVector, RealVector > | |
| typedef RealVector | OutputType |
| typedef RealVector | LabelType |
| typedef VectorMatrixTraits< OutputType >::DenseMatrixType | MatrixType |
| typedef Batch< OutputType >::type | BatchOutputType |
| typedef Batch< LabelType >::type | BatchLabelType |
Public Types inherited from shark::AbstractCost< RealVector, RealVector > | |
| enum | Feature |
| list of features a cost function can have More... | |
| typedef RealVector | OutputType |
| typedef RealVector | LabelType |
| typedef Batch< OutputType >::type | BatchOutputType |
| typedef Batch< LabelType >::type | BatchLabelType |
| typedef TypedFlags< Feature > | Features |
| typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Protected Attributes inherited from shark::AbstractCost< RealVector, RealVector > | |
| Features | m_features |
Hinge-loss for large margin regression.
The loss is defined as \(L_i = \sum_j^N \max\{0.0, |f_j(x_i)-y_{i,j}|-\epsilon\} \) 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. Points which are outside of the margin are linearly punished, that is the loss is outlier resistant.
Epsilon describes the size of the margin.
The hinge-loss is not differentiable at the points y_{i,j}+epsilon and y_{i,j}-epsilon.
Definition at line 51 of file EpsilonHingeLoss.h.
|
inline |
constructor
Definition at line 55 of file EpsilonHingeLoss.h.
References shark::AbstractCost< RealVector, RealVector >::m_features.
|
inlinevirtual |
calculates the sum of all
Implements shark::AbstractLoss< RealVector, RealVector >.
Definition at line 65 of file EpsilonHingeLoss.h.
References shark::blas::max(), SIZE_CHECK, and shark::blas::sum().
|
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 71 of file EpsilonHingeLoss.h.
References shark::blas::max(), and SIZE_CHECK.
|
inlinevirtual |
Returns class name "HingeLoss".
Reimplemented from shark::INameable.
Definition at line 60 of file EpsilonHingeLoss.h.