shark::AbsoluteLoss< VectorType > Class Template Reference

absolute loss More...

#include <shark/ObjectiveFunctions/Loss/AbsoluteLoss.h>

+ Inheritance diagram for shark::AbsoluteLoss< VectorType >:

Public Types

typedef base_type::BatchLabelType BatchLabelType
 
typedef base_type::BatchOutputType BatchOutputType
 
- Public Types inherited from shark::AbstractLoss< VectorType, VectorType >
typedef VectorType OutputType
 
typedef VectorType LabelType
 
typedef RealMatrix MatrixType
 
typedef Batch< OutputType >::type BatchOutputType
 
typedef Batch< LabelType >::type BatchLabelType
 
typedef ConstProxyReference< LabelType const >::type ConstLabelReference
 Const references to LabelType. More...
 
typedef ConstProxyReference< OutputType const >::type ConstOutputReference
 Const references to OutputType. More...
 
- Public Types inherited from shark::AbstractCost< VectorType, VectorType >
enum  Feature
 list of features a cost function can have More...
 
typedef VectorType OutputType
 
typedef VectorType LabelType
 
typedef Batch< OutputType >::type BatchOutputType
 
typedef Batch< LabelType >::type BatchLabelType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 

Public Member Functions

 AbsoluteLoss ()
 constructor More...
 
std::string name () const
 From INameable: return the class name. More...
 
double eval (BatchLabelType const &labels, BatchOutputType const &predictions) const
 
- Public Member Functions inherited from shark::AbstractLoss< VectorType, VectorType >
 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...
 
virtual double evalDerivative (BatchLabelType const &target, BatchOutputType const &prediction, BatchOutputType &gradient) const
 evaluate the loss and the derivative w.r.t. the 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< VectorType, VectorType >
virtual ~AbstractCost ()
 
const Featuresfeatures () 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

- Protected Attributes inherited from shark::AbstractCost< VectorType, VectorType >
Features m_features
 

Detailed Description

template<class VectorType = RealVector>
class shark::AbsoluteLoss< VectorType >

absolute loss

The absolute loss is usually defined in a single dimension as the absolute value of the difference between labels and predictions. Here we generalize to multiple dimensions by returning the norm.

Definition at line 50 of file AbsoluteLoss.h.

Member Typedef Documentation

◆ BatchLabelType

template<class VectorType = RealVector>
typedef base_type::BatchLabelType shark::AbsoluteLoss< VectorType >::BatchLabelType

Definition at line 54 of file AbsoluteLoss.h.

◆ BatchOutputType

template<class VectorType = RealVector>
typedef base_type::BatchOutputType shark::AbsoluteLoss< VectorType >::BatchOutputType

Definition at line 55 of file AbsoluteLoss.h.

Constructor & Destructor Documentation

◆ AbsoluteLoss()

template<class VectorType = RealVector>
shark::AbsoluteLoss< VectorType >::AbsoluteLoss ( )
inline

constructor

Definition at line 58 of file AbsoluteLoss.h.

Member Function Documentation

◆ eval()

template<class VectorType = RealVector>
double shark::AbsoluteLoss< VectorType >::eval ( BatchLabelType const &  labels,
BatchOutputType const &  predictions 
) const
inlinevirtual

evaluate the loss \( \| labels - predictions \| \), which is a slight generalization of the absolute value of the difference.

Implements shark::AbstractLoss< VectorType, VectorType >.

Definition at line 71 of file AbsoluteLoss.h.

References SIZE_CHECK.

◆ name()

template<class VectorType = RealVector>
std::string shark::AbsoluteLoss< VectorType >::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 63 of file AbsoluteLoss.h.

References shark::AbstractLoss< VectorType, VectorType >::eval().


The documentation for this class was generated from the following file: