Cost function interface. More...
#include <shark/ObjectiveFunctions/AbstractCost.h>
Inheritance diagram for shark::AbstractCost< LabelT, OutputT >:
Collaboration diagram for shark::AbstractCost< LabelT, OutputT >:Public Types | |
| 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 | |
| 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... | |
| virtual double | eval (Data< LabelType > const &targets, Data< OutputType > const &predictions) const =0 |
| virtual double | evalDerivative (Data< LabelType > const &targets, Data< OutputType > const &predictions, Data< OutputType > &gradient) const |
| evaluates the cost and the derivative w.r.t. the prediction 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... | |
Protected Attributes | |
| Features | m_features |
Cost function interface.
Definition at line 68 of file AbstractCost.h.
| typedef Batch<LabelType>::type shark::AbstractCost< LabelT, OutputT >::BatchLabelType |
Definition at line 74 of file AbstractCost.h.
| typedef Batch<OutputType>::type shark::AbstractCost< LabelT, OutputT >::BatchOutputType |
Definition at line 73 of file AbstractCost.h.
| typedef TypedFeatureNotAvailableException<Feature> shark::AbstractCost< LabelT, OutputT >::FeatureNotAvailableException |
Definition at line 86 of file AbstractCost.h.
| typedef TypedFlags<Feature> shark::AbstractCost< LabelT, OutputT >::Features |
Definition at line 86 of file AbstractCost.h.
| typedef LabelT shark::AbstractCost< LabelT, OutputT >::LabelType |
Definition at line 72 of file AbstractCost.h.
| typedef OutputT shark::AbstractCost< LabelT, OutputT >::OutputType |
Definition at line 71 of file AbstractCost.h.
| enum shark::AbstractCost::Feature |
list of features a cost function can have
| Enumerator | |
|---|---|
| HAS_FIRST_DERIVATIVE | |
| IS_LOSS_FUNCTION | |
Definition at line 80 of file AbstractCost.h.
|
inlinevirtual |
Definition at line 76 of file AbstractCost.h.
|
inlinevirtual |
configures the loss using informations in the property tree
| node | the configuration node |
Reimplemented from shark::IConfigurable.
Definition at line 109 of file AbstractCost.h.
Referenced by shark::detail::ErrorFunctionWrapper< InputType, LabelType, OutputType >::configure(), shark::DenoisingAutoencoderError< InputType, RngType >::configure(), and shark::detail::NoisyErrorFunctionWrapper< InputType, LabelType, OutputType, RngType >::configure().
|
pure virtual |
Evaluates the cost of predictions, given targets.
| targets | target values |
| predictions | predictions, typically made by a model |
Implemented in shark::NegativeWilcoxonMannWhitneyStatistic< LabelType, OutputType >, shark::AbstractLoss< LabelT, OutputT >, shark::AbstractLoss< LabelType >, shark::AbstractLoss< RealVector, RealVector >, shark::AbstractLoss< unsigned int, unsigned int >, shark::AbstractLoss< LabelType, OutputType >, shark::AbstractLoss< VectorType, VectorType >, shark::AbstractLoss< LabelType, LabelType >, shark::AbstractLoss< unsigned int, RealVector >, shark::AbstractLoss< InputType, InputType >, and shark::NegativeAUC< LabelType, OutputType >.
Referenced by shark::CrossValidationError< ModelTypeT, LabelTypeT >::eval(), shark::detail::CostBasedErrorFunctionImpl< InputType, LabelType, OutputType >::eval(), and shark::AbstractCost< InputType, InputType >::operator()().
|
inlinevirtual |
evaluates the cost and the derivative w.r.t. the prediction
| targets | target values |
| predictions | predictions, typically made by a model |
| gradient | the gradient of the cost function with respect to the predictions |
Reimplemented in shark::AbstractLoss< LabelT, OutputT >, shark::AbstractLoss< LabelType >, shark::AbstractLoss< RealVector, RealVector >, shark::AbstractLoss< unsigned int, unsigned int >, shark::AbstractLoss< LabelType, OutputType >, shark::AbstractLoss< VectorType, VectorType >, shark::AbstractLoss< LabelType, LabelType >, shark::AbstractLoss< unsigned int, RealVector >, and shark::AbstractLoss< InputType, InputType >.
Definition at line 126 of file AbstractCost.h.
|
inline |
Definition at line 86 of file AbstractCost.h.
|
inline |
returns true when the first parameter derivative is implemented
Definition at line 89 of file AbstractCost.h.
Referenced by shark::DenoisingAutoencoderError< InputType, RngType >::DenoisingAutoencoderError(), shark::detail::ErrorFunctionWrapper< InputType, LabelType, OutputType >::updateFeatures(), and shark::detail::NoisyErrorFunctionWrapper< InputType, LabelType, OutputType, RngType >::updateFeatures().
|
inline |
returns true when the cost function is in fact a loss function
Definition at line 98 of file AbstractCost.h.
Referenced by shark::ErrorFunction< InputType, LabelType >::ErrorFunction().
|
inline |
Definition at line 135 of file AbstractCost.h.
|
inlinevirtual |
Definition at line 86 of file AbstractCost.h.
Referenced by shark::detail::ErrorFunctionWrapper< InputType, LabelType, OutputType >::updateFeatures().
|
protected |
Definition at line 86 of file AbstractCost.h.
Referenced by shark::AbstractLoss< InputType, InputType >::AbstractLoss(), shark::AbstractCost< InputType, InputType >::hasFirstDerivative(), and shark::AbstractCost< InputType, InputType >::isLossFunction().