shark::OptimizationTrainer< Model, LabelTypeT > Class Template Reference

Wrapper for training schemes based on (iterative) optimization. More...

#include <shark/Algorithms/Trainers/OptimizationTrainer.h>

+ Inheritance diagram for shark::OptimizationTrainer< Model, LabelTypeT >:

Public Types

typedef base_type::InputType InputType
 
typedef base_type::LabelType LabelType
 
typedef base_type::ModelType ModelType
 
typedef AbstractSingleObjectiveOptimizer< RealVector > OptimizerType
 
typedef AbstractLoss< LabelType, InputTypeLossType
 
typedef AbstractStoppingCriterion< SingleObjectiveResultSet< OptimizerType::SearchPointType > > StoppingCriterionType
 
- Public Types inherited from shark::AbstractTrainer< Model, LabelTypeT >
typedef Model ModelType
 
typedef ModelType::InputType InputType
 
typedef LabelTypeT LabelType
 
typedef LabeledData< InputType, LabelTypeDatasetType
 

Public Member Functions

 OptimizationTrainer (LossType *loss, OptimizerType *optimizer, StoppingCriterionType *stoppingCriterion)
 
std::string name () const
 From INameable: return the class name. More...
 
void train (ModelType &model, LabeledData< InputType, LabelType > const &dataset)
 
void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
void write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
- Public Member Functions inherited from shark::AbstractTrainer< Model, LabelTypeT >
virtual void train (ModelType &model, DatasetType const &dataset)=0
 Core of the Trainer interface. More...
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Attributes

LossTypemep_loss
 
OptimizerTypemep_optimizer
 
StoppingCriterionTypemep_stoppingCriterion
 

Detailed Description

template<class Model, class LabelTypeT = typename Model::OutputType>
class shark::OptimizationTrainer< Model, LabelTypeT >

Wrapper for training schemes based on (iterative) optimization.

The OptimizationTrainer class is designed to allow for model training via iterative minimization of a loss function, such as in neural network "backpropagation" training.

Definition at line 58 of file OptimizationTrainer.h.

Member Typedef Documentation

◆ InputType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef base_type::InputType shark::OptimizationTrainer< Model, LabelTypeT >::InputType

Definition at line 63 of file OptimizationTrainer.h.

◆ LabelType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef base_type::LabelType shark::OptimizationTrainer< Model, LabelTypeT >::LabelType

Definition at line 64 of file OptimizationTrainer.h.

◆ LossType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef AbstractLoss< LabelType, InputType > shark::OptimizationTrainer< Model, LabelTypeT >::LossType

Definition at line 68 of file OptimizationTrainer.h.

◆ ModelType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef base_type::ModelType shark::OptimizationTrainer< Model, LabelTypeT >::ModelType

Definition at line 65 of file OptimizationTrainer.h.

◆ OptimizerType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef AbstractSingleObjectiveOptimizer< RealVector > shark::OptimizationTrainer< Model, LabelTypeT >::OptimizerType

Definition at line 67 of file OptimizationTrainer.h.

◆ StoppingCriterionType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef AbstractStoppingCriterion<SingleObjectiveResultSet<OptimizerType::SearchPointType> > shark::OptimizationTrainer< Model, LabelTypeT >::StoppingCriterionType

Definition at line 69 of file OptimizationTrainer.h.

Constructor & Destructor Documentation

◆ OptimizationTrainer()

template<class Model, class LabelTypeT = typename Model::OutputType>
shark::OptimizationTrainer< Model, LabelTypeT >::OptimizationTrainer ( LossType loss,
OptimizerType optimizer,
StoppingCriterionType stoppingCriterion 
)
inline

Definition at line 71 of file OptimizationTrainer.h.

References SHARK_RUNTIME_CHECK.

Member Function Documentation

◆ name()

template<class Model, class LabelTypeT = typename Model::OutputType>
std::string shark::OptimizationTrainer< Model, LabelTypeT >::name ( ) const
inlinevirtual

◆ read()

template<class Model, class LabelTypeT = typename Model::OutputType>
void shark::OptimizationTrainer< Model, LabelTypeT >::read ( InArchive archive)
inlinevirtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Definition at line 102 of file OptimizationTrainer.h.

◆ train()

◆ write()

template<class Model, class LabelTypeT = typename Model::OutputType>
void shark::OptimizationTrainer< Model, LabelTypeT >::write ( OutArchive archive) const
inlinevirtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Definition at line 105 of file OptimizationTrainer.h.

Member Data Documentation

◆ mep_loss

template<class Model, class LabelTypeT = typename Model::OutputType>
LossType* shark::OptimizationTrainer< Model, LabelTypeT >::mep_loss
protected

◆ mep_optimizer

template<class Model, class LabelTypeT = typename Model::OutputType>
OptimizerType* shark::OptimizationTrainer< Model, LabelTypeT >::mep_optimizer
protected

◆ mep_stoppingCriterion

template<class Model, class LabelTypeT = typename Model::OutputType>
StoppingCriterionType* shark::OptimizationTrainer< Model, LabelTypeT >::mep_stoppingCriterion
protected

The documentation for this class was generated from the following file: