Cost function interface. More...
#include <shark/ObjectiveFunctions/AbstractCost.h>
Public Types | |
enum | Feature { HAS_FIRST_DERIVATIVE = 1 , HAS_SECOND_DERIVATIVE = 2 , 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 | |
bool | isLossFunction () const |
returns true when the cost function is in fact a loss function | |
virtual double | eval (Data< LabelType > const &targets, Data< OutputType > const &predictions) const =0 |
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 | |
Protected Attributes | |
Features | m_features |
Cost function interface.
Definition at line 73 of file AbstractCost.h.
typedef Batch<LabelType>::type shark::AbstractCost< LabelT, OutputT >::BatchLabelType |
Definition at line 79 of file AbstractCost.h.
typedef Batch<OutputType>::type shark::AbstractCost< LabelT, OutputT >::BatchOutputType |
Definition at line 78 of file AbstractCost.h.
typedef TypedFeatureNotAvailableException<Feature> shark::AbstractCost< LabelT, OutputT >::FeatureNotAvailableException |
Definition at line 91 of file AbstractCost.h.
typedef TypedFlags<Feature> shark::AbstractCost< LabelT, OutputT >::Features |
Definition at line 91 of file AbstractCost.h.
typedef LabelT shark::AbstractCost< LabelT, OutputT >::LabelType |
Definition at line 77 of file AbstractCost.h.
typedef OutputT shark::AbstractCost< LabelT, OutputT >::OutputType |
Definition at line 76 of file AbstractCost.h.
enum shark::AbstractCost::Feature |
list of features a cost function can have
Enumerator | |
---|---|
HAS_FIRST_DERIVATIVE | |
HAS_SECOND_DERIVATIVE | |
IS_LOSS_FUNCTION |
Definition at line 85 of file AbstractCost.h.
|
inlinevirtual |
Definition at line 81 of file AbstractCost.h.
|
pure virtual |
Evaluates the cost of predictions, given targets.
targets | target values |
predictions | predictions, typically made by a model |
Implemented in shark::NegativeAUC< LabelType, OutputType >, shark::NegativeWilcoxonMannWhitneyStatistic< LabelType, OutputType >, shark::AbsoluteLoss< VectorType >, shark::AbstractLoss< LabelT, OutputT >, shark::SquaredLoss< OutputType, LabelType >, and shark::ZeroOneLoss< LabelType, OutputType >.
Referenced by shark::CrossValidationError< ModelTypeT, LabelTypeT >::eval(), and shark::AbstractCost< LabelT, OutputT >::operator()().
|
inline |
Definition at line 91 of file AbstractCost.h.
|
inline |
returns true when the first parameter derivative is implemented
Definition at line 94 of file AbstractCost.h.
References shark::AbstractCost< LabelT, OutputT >::HAS_FIRST_DERIVATIVE, and shark::AbstractCost< LabelT, OutputT >::m_features.
|
inline |
returns true when the cost function is in fact a loss function
Definition at line 103 of file AbstractCost.h.
References shark::AbstractCost< LabelT, OutputT >::IS_LOSS_FUNCTION, and shark::AbstractCost< LabelT, OutputT >::m_features.
|
inline |
Evaluates the cost of predictions, given targets.
targets | Targets of the predictions |
predictions | Predictions to be compared with the targets |
Definition at line 116 of file AbstractCost.h.
References shark::AbstractCost< LabelT, OutputT >::eval().
|
inlinevirtual |
Definition at line 91 of file AbstractCost.h.
|
protected |
Definition at line 91 of file AbstractCost.h.
Referenced by shark::AbstractLoss< LabelT, OutputT >::AbstractLoss(), shark::EpsilonHingeLoss::EpsilonHingeLoss(), shark::AbstractCost< LabelT, OutputT >::hasFirstDerivative(), shark::HingeLoss::HingeLoss(), shark::HuberLoss::HuberLoss(), shark::AbstractCost< LabelT, OutputT >::isLossFunction(), shark::SquaredEpsilonHingeLoss::SquaredEpsilonHingeLoss(), shark::SquaredHingeLoss::SquaredHingeLoss(), shark::SquaredLoss< OutputType, LabelType >::SquaredLoss(), shark::SquaredLoss< OutputType, unsigned int >::SquaredLoss(), and shark::SquaredLoss< Sequence, Sequence >::SquaredLoss().