Loss function interface. More...
#include <shark/ObjectiveFunctions/Loss/AbstractLoss.h>
Inheritance diagram for shark::AbstractLoss< LabelT, OutputT >:
Collaboration diagram for shark::AbstractLoss< LabelT, OutputT >:Public Types | |
| typedef OutputT | OutputType |
| typedef LabelT | LabelType |
| typedef VectorMatrixTraits < OutputType > ::DenseMatrixType | MatrixType |
| typedef Batch< OutputType >::type | BatchOutputType |
| typedef Batch< LabelType >::type | BatchLabelType |
Public Types inherited from shark::AbstractCost< LabelT, OutputT > | |
| enum | Feature { HAS_FIRST_DERIVATIVE = 1, IS_LOSS_FUNCTION = 4 } |
| list of features a cost function can have More... | |
| typedef OutputT | OutputType |
| typedef LabelT | LabelType |
| typedef Batch< OutputType >::type | BatchOutputType |
| typedef Batch< LabelType >::type | BatchLabelType |
| typedef TypedFlags< Feature > | Features |
| typedef TypedFeatureNotAvailableException < Feature > | FeatureNotAvailableException |
Public Member Functions | |
| AbstractLoss () | |
| virtual double | eval (BatchLabelType const &target, BatchOutputType const &prediction) const =0 |
| evaluate the loss for a batch of targets and a prediction More... | |
| virtual double | eval (LabelType const &target, OutputType const &prediction) const |
| evaluate the loss 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 | eval (Data< LabelType > const &targets, Data< OutputType > const &predictions) const |
| 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< LabelT, OutputT > | |
| 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 () |
| virtual std::string | name () const |
| returns the name of the object More... | |
Public Member Functions inherited from shark::IConfigurable | |
| virtual | ~IConfigurable () |
| Virtual d'tor. More... | |
Additional Inherited Members | |
Protected Attributes inherited from shark::AbstractCost< LabelT, OutputT > | |
| Features | m_features |
Loss function interface.
Definition at line 57 of file AbstractLoss.h.
| typedef Batch<LabelType>::type shark::AbstractLoss< LabelT, OutputT >::BatchLabelType |
Definition at line 66 of file AbstractLoss.h.
| typedef Batch<OutputType>::type shark::AbstractLoss< LabelT, OutputT >::BatchOutputType |
Definition at line 65 of file AbstractLoss.h.
| typedef LabelT shark::AbstractLoss< LabelT, OutputT >::LabelType |
Definition at line 62 of file AbstractLoss.h.
| typedef VectorMatrixTraits<OutputType>::DenseMatrixType shark::AbstractLoss< LabelT, OutputT >::MatrixType |
Definition at line 63 of file AbstractLoss.h.
| typedef OutputT shark::AbstractLoss< LabelT, OutputT >::OutputType |
Definition at line 61 of file AbstractLoss.h.
|
inline |
Definition at line 68 of file AbstractLoss.h.
|
pure virtual |
evaluate the loss for a batch of targets and a prediction
| target | target values |
| prediction | predictions, typically made by a model |
Implemented in shark::ZeroOneLoss< unsigned int, RealVector >, shark::AbsoluteLoss< VectorType >, shark::DiscreteLoss, shark::ZeroOneLoss< LabelType, OutputType >, and shark::SquaredLoss< VectorType >.
Referenced by shark::AbstractLoss< InputType, InputType >::eval(), shark::DenoisingAutoencoderError< InputType, RngType >::eval(), shark::detail::NoisyErrorFunctionWrapper< InputType, LabelType, OutputType, RngType >::eval(), shark::LooError< ModelTypeT, LabelType >::eval(), shark::detail::SparseFFNetErrorWrapper< HiddenNeuron, OutputNeuron >::eval(), shark::detail::LossBasedErrorFunctionImpl< InputType, LabelType, OutputType >::evalPointSet(), and shark::AbstractLoss< InputType, InputType >::operator()().
|
inlinevirtual |
evaluate the loss for a target and a prediction
| target | target value |
| prediction | prediction, typically made by a model |
Reimplemented in shark::CrossEntropyIndependent.
Definition at line 82 of file AbstractLoss.h.
|
inlinevirtual |
from AbstractCost
| targets | target values |
| predictions | predictions, typically made by a model |
Implements shark::AbstractCost< LabelT, OutputT >.
Definition at line 129 of file AbstractLoss.h.
|
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 in shark::SquaredLoss< VectorType >.
Definition at line 99 of file AbstractLoss.h.
Referenced by shark::detail::NoisyErrorFunctionWrapper< InputType, LabelType, OutputType, RngType >::evalDerivative(), shark::DenoisingAutoencoderError< InputType, RngType >::evalDerivative(), shark::AbstractLoss< InputType, InputType >::evalDerivative(), and shark::detail::LossBasedErrorFunctionImpl< InputType, LabelType, OutputType >::evalDerivativePointSet().
|
inlinevirtual |
from AbstractCost
| targets | target values |
| predictions | predictions, typically made by a model |
| gradient | the gradient of the cost function with respect to the predictions |
Reimplemented from shark::AbstractCost< LabelT, OutputT >.
Definition at line 148 of file AbstractLoss.h.
|
inline |
evaluate the loss for a target and a prediction
| target | target value |
| prediction | prediction, typically made by a model |
Definition at line 178 of file AbstractLoss.h.
|
inline |
Definition at line 181 of file AbstractLoss.h.