GestureRecognitionToolkit  Version: 0.2.5
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
WeakClassifier Class Reference
Inheritance diagram for WeakClassifier:
DecisionStump RadialBasisFunction RegisterWeakClassifierModule< T > RegisterWeakClassifierModule< DecisionStump > RegisterWeakClassifierModule< RadialBasisFunction >

Public Types

typedef std::map< std::string, WeakClassifier *(*)() > StringWeakClassifierMap
 

Public Member Functions

 WeakClassifier ()
 
virtual ~WeakClassifier ()
 
 WeakClassifier (const WeakClassifier &rhs)
 
WeakClassifieroperator= (const WeakClassifier &rhs)
 
bool copyBaseVariables (const WeakClassifier *weakClassifer)
 
virtual bool deepCopyFrom (const WeakClassifier *weakClassifer)
 
virtual bool train (ClassificationData &trainingData, VectorFloat &weights)
 
virtual Float predict (const VectorFloat &x)
 
virtual bool saveModelToFile (std::fstream &file) const
 
virtual bool loadModelFromFile (std::fstream &file)
 
virtual void print () const
 
virtual Float getPositiveClassLabel () const
 
virtual Float getNegativeClassLabel () const
 
std::string getWeakClassifierType () const
 
bool getTrained () const
 
UINT getNumInputDimensions () const
 
bool getTrainingLoggingEnabled () const
 
bool setTrainingLoggingEnabled (const bool enabled)
 
WeakClassifiercreateNewInstance () const
 

Static Public Member Functions

static WeakClassifiercreateInstanceFromString (std::string const &weakClassifierType)
 

Static Protected Member Functions

static StringWeakClassifierMapgetMap ()
 

Protected Attributes

std::string weakClassifierType
 A string that represents the weak classifier type, e.g. DecisionStump.
 
bool trained
 A flag to show if the weak classifier model has been trained.
 
UINT numInputDimensions
 The number of input dimensions to the weak classifier.
 
TrainingLog trainingLog
 
ErrorLog errorLog
 
WarningLog warningLog
 

Detailed Description

Definition at line 40 of file WeakClassifier.h.

Member Typedef Documentation

typedef std::map< std::string, WeakClassifier*(*)() > WeakClassifier::StringWeakClassifierMap

Defines a map between a string (which will contain the name of the WeakClassifier, such as DecisionStump) and a function returns a new instance of that WeakClassifier

Definition at line 177 of file WeakClassifier.h.

Constructor & Destructor Documentation

WeakClassifier::WeakClassifier ( )

Default Constructor.

Definition at line 45 of file WeakClassifier.cpp.

WeakClassifier::~WeakClassifier ( )
virtual

Default Destructor.

Definition at line 52 of file WeakClassifier.cpp.

WeakClassifier::WeakClassifier ( const WeakClassifier rhs)
inline

Copy Constructor. Defines how the data from the rhs instance are copied to this instance.

Parameters
rhsthe rhs instance from which the data will be copied to this instance

Definition at line 57 of file WeakClassifier.h.

Member Function Documentation

bool WeakClassifier::copyBaseVariables ( const WeakClassifier weakClassifer)

This function copies the WeakClassifier base variables from the weakClassifer pointer to this instance.

Parameters
weakClassiferthe instance from which the data will be copied to this instance
Returns
returns true if the base variables were copied, false otherwise

Definition at line 71 of file WeakClassifier.cpp.

WeakClassifier * WeakClassifier::createInstanceFromString ( std::string const &  weakClassifierType)
static

Creates a new WeakClassifier instance based on the input string (which should contain the name of a valid WeakClassifier such as DecisionStump).

Parameters
weakClassifierTypethe name of the WeakClassifier
Returns
WeakClassifier*: a pointer to the new instance of the WeakClassifier

Definition at line 36 of file WeakClassifier.cpp.

WeakClassifier * WeakClassifier::createNewInstance ( ) const

Creates a new WeakClassifier instance based on the current weakClassifierType string value.

Returns
WeakClassifier*: a pointer to the new instance of the WeakClassifier

Definition at line 82 of file WeakClassifier.cpp.

virtual bool WeakClassifier::deepCopyFrom ( const WeakClassifier weakClassifer)
inlinevirtual

This function performs a deep copy of the inherited classes variables from the weakClassifer pointer instance to this instance. This function should be overwritten in the inheriting class.

Parameters
constWeakClassifier *weakClassifer: the instance from which the data will be deep copied to this instance
Returns
returns true if the deep copy was successful, false otherwise

Reimplemented in RadialBasisFunction, and DecisionStump.

Definition at line 84 of file WeakClassifier.h.

virtual Float WeakClassifier::getNegativeClassLabel ( ) const
inlinevirtual
Returns
returns the negative class label for this WeakClassifier

Definition at line 143 of file WeakClassifier.h.

UINT WeakClassifier::getNumInputDimensions ( ) const
inline
Returns
returns the number of input dimensions expected by the WeakClassifier

Definition at line 162 of file WeakClassifier.h.

virtual Float WeakClassifier::getPositiveClassLabel ( ) const
inlinevirtual
Returns
returns the positive class label for this WeakClassifier

Definition at line 138 of file WeakClassifier.h.

bool WeakClassifier::getTrained ( ) const
inline
Returns
returns true if the WeakClassifier model has been trained, false otherwise

Definition at line 155 of file WeakClassifier.h.

std::string WeakClassifier::getWeakClassifierType ( ) const
inline
Returns
returns the weak classifier type as a string, e.g. DecisionStump

Definition at line 148 of file WeakClassifier.h.

virtual bool WeakClassifier::loadModelFromFile ( std::fstream &  file)
inlinevirtual

This function can be used to load the WeakClassifier model and settings. This function should be overwritten in the inheriting class.

Parameters
filea reference to the file that the model will be saved to
Returns
returns true if the data was loaded, false otherwise

Reimplemented in RadialBasisFunction, and DecisionStump.

Definition at line 127 of file WeakClassifier.h.

WeakClassifier & WeakClassifier::operator= ( const WeakClassifier rhs)

Equals Operator. Defines how the data from the rhs instance are copied to this instance.

Parameters
rhsthe rhs instance from which the data will be copied to this instance
Returns
returns a reference to this WeakClassifier instance

Definition at line 59 of file WeakClassifier.cpp.

virtual Float WeakClassifier::predict ( const VectorFloat x)
inlinevirtual

This function is the main predict interface for all the WeakClassifiers. This function should be overwritten in the inheriting class.

Parameters
xthe input vector to be classified, should have the same dimensionality as the data used to train the model
Returns
returns a Float value representing the prediction, which is normally -1 or +1

Reimplemented in RadialBasisFunction, and DecisionStump.

Definition at line 107 of file WeakClassifier.h.

virtual void WeakClassifier::print ( ) const
inlinevirtual

This function can be used to print the WeakClassifier model and settings. This function should be overwritten in the inheriting class.

Reimplemented in RadialBasisFunction, and DecisionStump.

Definition at line 133 of file WeakClassifier.h.

virtual bool WeakClassifier::saveModelToFile ( std::fstream &  file) const
inlinevirtual

This function can be used to save the WeakClassifier model and settings. This function should be overwritten in the inheriting class.

Parameters
filea reference to the file that the model will be saved to
Returns
returns true if the data was saved, false otherwise

Reimplemented in RadialBasisFunction, and DecisionStump.

Definition at line 118 of file WeakClassifier.h.

virtual bool WeakClassifier::train ( ClassificationData trainingData,
VectorFloat weights 
)
inlinevirtual

This function is the main training interface for all the WeakClassifiers. This function should be overwritten in the inheriting class.

Parameters
trainingDataa reference to the training data that will be used to train the weak classifier model
weightsthe weight for each training sample, there should be as many weights as there are training samples
Returns
returns true if the weak classifier model was trained successful, false otherwise

Reimplemented in RadialBasisFunction, and DecisionStump.

Definition at line 96 of file WeakClassifier.h.


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