Leave-one-out error objective function. More...
#include <shark/ObjectiveFunctions/LooError.h>
Public Types | |
typedef ModelTypeT | ModelType |
typedef ModelType::InputType | InputType |
typedef ModelType::OutputType | OutputType |
typedef LabeledData< InputType, LabelType > | DatasetType |
typedef AbstractTrainer< ModelType, LabelType > | TrainerType |
typedef AbstractLoss< LabelType, typename ModelType::OutputType > | LossType |
Public Types inherited from shark::AbstractObjectiveFunction< RealVector, double > | |
enum | Feature |
List of features that are supported by an implementation. More... | |
typedef RealVector | SearchPointType |
typedef double | ResultType |
typedef boost::mpl::if_< std::is_arithmetic< double >, SearchPointType, RealMatrix >::type | FirstOrderDerivative |
typedef TypedFlags< Feature > | Features |
This statement declares the member m_features. See Core/Flags.h for details. More... | |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Public Member Functions | |
LooError (DatasetType const &dataset, ModelType *model, TrainerType *trainer, LossType *loss, IParameterizable<> *meta=NULL) | |
Constructor. More... | |
std::string | name () const |
From INameable: return the class name. More... | |
std::size_t | numberOfVariables () const |
Accesses the number of variables. More... | |
double | eval () const |
double | eval (const RealVector ¶meters) const |
Public Member Functions inherited from shark::AbstractObjectiveFunction< RealVector, double > | |
const Features & | features () const |
virtual void | updateFeatures () |
bool | hasValue () const |
returns whether this function can calculate it's function value More... | |
bool | hasFirstDerivative () const |
returns whether this function can calculate the first derivative More... | |
bool | hasSecondDerivative () const |
returns whether this function can calculate the second derivative More... | |
bool | canProposeStartingPoint () const |
returns whether this function can propose a starting point. More... | |
bool | isConstrained () const |
returns whether this function can return More... | |
bool | hasConstraintHandler () const |
returns whether this function can return More... | |
bool | canProvideClosestFeasible () const |
Returns whether this function can calculate thee closest feasible to an infeasible point. More... | |
bool | isThreadSafe () const |
Returns true, when the function can be usd in parallel threads. More... | |
bool | isNoisy () const |
Returns true, when the function can be usd in parallel threads. More... | |
AbstractObjectiveFunction () | |
Default ctor. More... | |
virtual | ~AbstractObjectiveFunction () |
Virtual destructor. More... | |
virtual void | init () |
void | setRng (random::rng_type *rng) |
Sets the Rng used by the objective function. More... | |
virtual bool | hasScalableDimensionality () const |
virtual void | setNumberOfVariables (std::size_t numberOfVariables) |
Adjusts the number of variables if the function is scalable. More... | |
virtual std::size_t | numberOfObjectives () const |
virtual bool | hasScalableObjectives () const |
virtual void | setNumberOfObjectives (std::size_t numberOfObjectives) |
Adjusts the number of objectives if the function is scalable. More... | |
std::size_t | evaluationCounter () const |
Accesses the evaluation counter of the function. More... | |
AbstractConstraintHandler< SearchPointType > const & | getConstraintHandler () const |
Returns the constraint handler of the function if it has one. More... | |
virtual bool | isFeasible (const SearchPointType &input) const |
Tests whether a point in SearchSpace is feasible, e.g., whether the constraints are fulfilled. More... | |
virtual void | closestFeasible (SearchPointType &input) const |
If supported, the supplied point is repaired such that it satisfies all of the function's constraints. More... | |
virtual SearchPointType | proposeStartingPoint () const |
Proposes a starting point in the feasible search space of the function. More... | |
ResultType | operator() (SearchPointType const &input) const |
Evaluates the function. Useful together with STL-Algorithms like std::transform. More... | |
virtual ResultType | evalDerivative (SearchPointType const &input, FirstOrderDerivative &derivative) const |
Evaluates the objective function and calculates its gradient. More... | |
virtual ResultType | evalDerivative (SearchPointType const &input, SecondOrderDerivative &derivative) const |
Evaluates the objective function and calculates its gradient. More... | |
Public Member Functions inherited from shark::INameable | |
virtual | ~INameable () |
Protected Attributes | |
DataView< DatasetType const > | m_dataset |
IParameterizable * | mep_meta |
ModelType * | mep_model |
TrainerType * | mep_trainer |
LossType * | mep_loss |
Protected Attributes inherited from shark::AbstractObjectiveFunction< RealVector, double > | |
Features | m_features |
std::size_t | m_evaluationCounter |
Evaluation counter, default value: 0. More... | |
AbstractConstraintHandler< SearchPointType > const * | m_constraintHandler |
random::rng_type * | mep_rng |
Additional Inherited Members | |
Protected Member Functions inherited from shark::AbstractObjectiveFunction< RealVector, double > | |
void | announceConstraintHandler (AbstractConstraintHandler< SearchPointType > const *handler) |
helper function which is called to announce the presence of an constraint handler. More... | |
Leave-one-out error objective function.
Definition at line 63 of file LooError.h.
typedef LabeledData<InputType, LabelType> shark::LooError< ModelTypeT, LabelType >::DatasetType |
Definition at line 69 of file LooError.h.
typedef ModelType::InputType shark::LooError< ModelTypeT, LabelType >::InputType |
Definition at line 67 of file LooError.h.
typedef AbstractLoss<LabelType, typename ModelType::OutputType> shark::LooError< ModelTypeT, LabelType >::LossType |
Definition at line 71 of file LooError.h.
typedef ModelTypeT shark::LooError< ModelTypeT, LabelType >::ModelType |
Definition at line 66 of file LooError.h.
typedef ModelType::OutputType shark::LooError< ModelTypeT, LabelType >::OutputType |
Definition at line 68 of file LooError.h.
typedef AbstractTrainer<ModelType, LabelType> shark::LooError< ModelTypeT, LabelType >::TrainerType |
Definition at line 70 of file LooError.h.
|
inline |
Constructor.
dataset | Full data set for leave-one-out. |
model | Model built on subsets of the data. |
trainer | Trainer for learning on each subset. |
loss | Loss function for judging the validation output. |
meta | Meta object with parameters that influences the process, typically a trainer. |
Definition at line 82 of file LooError.h.
References shark::AbstractObjectiveFunction< RealVector, double >::HAS_VALUE, and shark::AbstractObjectiveFunction< RealVector, double >::m_features.
|
inline |
Evaluate the leave-one-out error: train sub-models, evaluate objective, return the average.
Definition at line 114 of file LooError.h.
References shark::LooError< ModelTypeT, LabelType >::m_dataset, and shark::AbstractObjectiveFunction< RealVector, double >::m_evaluationCounter.
Referenced by shark::LooError< ModelTypeT, LabelType >::eval().
|
inlinevirtual |
Evaluate the leave-one-out error for the given parameters passed to the meta object (typically these parameters need to be optimized in a model selection procedure).
Reimplemented from shark::AbstractObjectiveFunction< RealVector, double >.
Definition at line 138 of file LooError.h.
References shark::LooError< ModelTypeT, LabelType >::eval(), shark::LooError< ModelTypeT, LabelType >::mep_meta, shark::IParameterizable< VectorType >::setParameterVector(), and SHARK_ASSERT.
|
inlinevirtual |
From INameable: return the class name.
Reimplemented from shark::INameable.
Definition at line 99 of file LooError.h.
References shark::LooError< ModelTypeT, LabelType >::mep_loss, shark::LooError< ModelTypeT, LabelType >::mep_model, shark::LooError< ModelTypeT, LabelType >::mep_trainer, and shark::INameable::name().
|
inlinevirtual |
Accesses the number of variables.
Implements shark::AbstractObjectiveFunction< RealVector, double >.
Definition at line 107 of file LooError.h.
References shark::LooError< ModelTypeT, LabelType >::mep_meta, and shark::IParameterizable< VectorType >::numberOfParameters().
|
protected |
Definition at line 144 of file LooError.h.
Referenced by shark::LooError< ModelTypeT, LabelType >::eval().
|
protected |
Definition at line 148 of file LooError.h.
Referenced by shark::LooError< ModelTypeT, LabelType >::name().
|
protected |
Definition at line 145 of file LooError.h.
Referenced by shark::LooError< ModelTypeT, LabelType >::eval(), and shark::LooError< ModelTypeT, LabelType >::numberOfVariables().
|
protected |
Definition at line 146 of file LooError.h.
Referenced by shark::LooError< ModelTypeT, LabelType >::name().
|
protected |
Definition at line 147 of file LooError.h.
Referenced by shark::LooError< ModelTypeT, LabelType >::name().