0-1-loss for classification. More...
#include <shark/ObjectiveFunctions/Loss/ZeroOneLoss.h>
Inheritance diagram for shark::ZeroOneLoss< LabelType, OutputType >:
Collaboration diagram for shark::ZeroOneLoss< LabelType, OutputType >:Public Types | |
| typedef base_type::BatchLabelType | BatchLabelType |
| typedef base_type::BatchOutputType | BatchOutputType |
Public Types inherited from shark::AbstractLoss< LabelType, LabelType > | |
| typedef LabelType | OutputType |
| typedef LabelType | LabelType |
| typedef VectorMatrixTraits < OutputType > ::DenseMatrixType | MatrixType |
| typedef Batch< OutputType >::type | BatchOutputType |
| typedef Batch< LabelType >::type | BatchLabelType |
Public Types inherited from shark::AbstractCost< LabelType, LabelType > | |
| enum | Feature |
| list of features a cost function can have More... | |
| typedef LabelType | OutputType |
| typedef LabelType | LabelType |
| typedef Batch< OutputType >::type | BatchOutputType |
| typedef Batch< LabelType >::type | BatchLabelType |
| typedef TypedFlags< Feature > | Features |
| typedef TypedFeatureNotAvailableException < Feature > | FeatureNotAvailableException |
Public Member Functions | |
| ZeroOneLoss () | |
| constructor More... | |
| std::string | name () const |
| From INameable: return the class name. More... | |
| double | eval (BatchLabelType const &labels, BatchOutputType const &predictions) const |
| Return zero if labels == predictions and one otherwise. More... | |
Public Member Functions inherited from shark::AbstractLoss< LabelType, LabelType > | |
| 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 (BatchLabelType const &target, BatchOutputType const &prediction, BatchOutputType &gradient) const |
| evaluate the loss and the derivative w.r.t. the prediction More... | |
| double | evalDerivative (Data< LabelType > const &targets, Data< OutputType > const &predictions, Data< OutputType > &gradient) const |
| 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< LabelType, LabelType > | |
| 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... | |
| void | configure (PropertyTree const &node) |
| configures the loss using informations in the property tree More... | |
| double | operator() (Data< LabelType > const &targets, Data< OutputType > const &predictions) const |
Public Member Functions inherited from shark::INameable | |
| virtual | ~INameable () |
Public Member Functions inherited from shark::IConfigurable | |
| virtual | ~IConfigurable () |
| Virtual d'tor. More... | |
Additional Inherited Members | |
Protected Attributes inherited from shark::AbstractCost< LabelType, LabelType > | |
| Features | m_features |
0-1-loss for classification.
The ZeroOneLoss requires the existence of the comparison operator == for its LabelType template parameter. The loss function returns zero of the predictions exactly matches the label, and one otherwise.
Definition at line 42 of file ZeroOneLoss.h.
| typedef base_type::BatchLabelType shark::ZeroOneLoss< LabelType, OutputType >::BatchLabelType |
Definition at line 46 of file ZeroOneLoss.h.
| typedef base_type::BatchOutputType shark::ZeroOneLoss< LabelType, OutputType >::BatchOutputType |
Definition at line 47 of file ZeroOneLoss.h.
|
inline |
constructor
Definition at line 50 of file ZeroOneLoss.h.
|
inlinevirtual |
Return zero if labels == predictions and one otherwise.
Implements shark::AbstractLoss< LabelType, LabelType >.
Definition at line 61 of file ZeroOneLoss.h.
References shark::size(), and SIZE_CHECK.
Referenced by main().
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 55 of file ZeroOneLoss.h.