shark::AbstractWeightedTrainer< Model, LabelTypeT > Class Template Referenceabstract

Superclass of weighted supervised learning algorithms. More...

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

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

Public Types

typedef base_type::ModelType ModelType
 
typedef base_type::InputType InputType
 
typedef base_type::LabelType LabelType
 
typedef base_type::DatasetType DatasetType
 
typedef WeightedLabeledData< InputType, LabelTypeWeightedDatasetType
 
- 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

virtual void train (ModelType &model, WeightedDatasetType const &dataset)=0
 Executes the algorithm and trains a model on the given weighted data. More...
 
virtual void train (ModelType &model, DatasetType const &dataset)
 Executes the algorithm and trains a model on the given unweighted data. More...
 
- 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::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
virtual void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
virtual void write (OutArchive &archive) const
 Write the component to the supplied archive. 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 ()
 

Detailed Description

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

Superclass of weighted supervised learning algorithms.

AbstractWeightedTrainer is the super class of all trainers that support weighted datasets. Weights are interpreted here as the importance of a sample. unweighted training assumes that all samples have the same importance, or weight. The higher the weight, the more important a point. Weight 0 is the same as if the point would not be part of the dataset. Negative weights are not allowed.

When all weights are integral values there is a simple interpretation of the weights as the multiplicity of a point. Thus training with a dataset with duplicate points is the same as counting the duplicates and run the algorithm with a weighted dataset where all points are unique and have their weight is the multiplicity.

Definition at line 60 of file AbstractWeightedTrainer.h.

Member Typedef Documentation

◆ DatasetType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef base_type::DatasetType shark::AbstractWeightedTrainer< Model, LabelTypeT >::DatasetType

Definition at line 68 of file AbstractWeightedTrainer.h.

◆ InputType

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

Definition at line 66 of file AbstractWeightedTrainer.h.

◆ LabelType

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

Definition at line 67 of file AbstractWeightedTrainer.h.

◆ ModelType

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

Definition at line 65 of file AbstractWeightedTrainer.h.

◆ WeightedDatasetType

template<class Model, class LabelTypeT = typename Model::OutputType>
typedef WeightedLabeledData<InputType, LabelType> shark::AbstractWeightedTrainer< Model, LabelTypeT >::WeightedDatasetType

Definition at line 69 of file AbstractWeightedTrainer.h.

Member Function Documentation

◆ train() [1/2]

template<class Model, class LabelTypeT = typename Model::OutputType>
virtual void shark::AbstractWeightedTrainer< Model, LabelTypeT >::train ( ModelType model,
WeightedDatasetType const &  dataset 
)
pure virtual

◆ train() [2/2]

template<class Model, class LabelTypeT = typename Model::OutputType>
virtual void shark::AbstractWeightedTrainer< Model, LabelTypeT >::train ( ModelType model,
DatasetType const &  dataset 
)
inlinevirtual

Executes the algorithm and trains a model on the given unweighted data.

This method behaves as using train with a weighted dataset where all weights are equal. The default implementation just creates such a dataset and executes the weighted version of the algorithm.

Implements shark::AbstractTrainer< Model, LabelTypeT >.

Definition at line 79 of file AbstractWeightedTrainer.h.


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