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

Public Types

typedef std::map< 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, VectorDouble &weights)
 
virtual double predict (const VectorDouble &x)
 
virtual bool saveModelToFile (fstream &file) const
 
virtual bool loadModelFromFile (fstream &file)
 
virtual void print () const
 
virtual double getPositiveClassLabel () const
 
virtual double getNegativeClassLabel () const
 
string getWeakClassifierType () const
 
bool getTrained () const
 
UINT getNumInputDimensions () const
 
WeakClassifiercreateNewInstance () const
 

Static Public Member Functions

static WeakClassifiercreateInstanceFromString (string const &weakClassifierType)
 

Static Protected Member Functions

static StringWeakClassifierMapgetMap ()
 

Protected Attributes

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

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 169 of file WeakClassifier.h.

Constructor & Destructor Documentation

GRT::WeakClassifier::WeakClassifier ( )

Default Constructor.

Definition at line 44 of file WeakClassifier.cpp.

GRT::WeakClassifier::~WeakClassifier ( )
virtual

Default Destructor.

Definition at line 51 of file WeakClassifier.cpp.

GRT::WeakClassifier::WeakClassifier ( const WeakClassifier rhs)
inline

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

Parameters
constWeakClassifier &rhs: the rhs instance from which the data will be copied to this instance

Definition at line 57 of file WeakClassifier.h.

Member Function Documentation

bool GRT::WeakClassifier::copyBaseVariables ( const WeakClassifier weakClassifer)

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

Parameters
constWeakClassifier *weakClassifer: the 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 70 of file WeakClassifier.cpp.

WeakClassifier * GRT::WeakClassifier::createInstanceFromString ( 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
stringconst &weakClassifierType: the name of the WeakClassifier
Returns
WeakClassifier*: a pointer to the new instance of the WeakClassifier

Definition at line 35 of file WeakClassifier.cpp.

WeakClassifier * GRT::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 81 of file WeakClassifier.cpp.

virtual bool GRT::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 GRT::RadialBasisFunction, and GRT::DecisionStump.

Definition at line 84 of file WeakClassifier.h.

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

Definition at line 143 of file WeakClassifier.h.

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

Definition at line 162 of file WeakClassifier.h.

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

Definition at line 138 of file WeakClassifier.h.

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

Definition at line 155 of file WeakClassifier.h.

string GRT::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 GRT::WeakClassifier::loadModelFromFile ( 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
fstream&file: a reference to the file that the model will be saved to
Returns
returns true if the data was loaded, false otherwise

Reimplemented in GRT::RadialBasisFunction, and GRT::DecisionStump.

Definition at line 127 of file WeakClassifier.h.

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

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

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

Definition at line 58 of file WeakClassifier.cpp.

virtual double GRT::WeakClassifier::predict ( const VectorDouble &  x)
inlinevirtual

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

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

Reimplemented in GRT::RadialBasisFunction, and GRT::DecisionStump.

Definition at line 107 of file WeakClassifier.h.

virtual void GRT::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 GRT::RadialBasisFunction, and GRT::DecisionStump.

Definition at line 133 of file WeakClassifier.h.

virtual bool GRT::WeakClassifier::saveModelToFile ( 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
fstream&file: a reference to the file that the model will be saved to
Returns
returns true if the data was saved, false otherwise

Reimplemented in GRT::RadialBasisFunction, and GRT::DecisionStump.

Definition at line 118 of file WeakClassifier.h.

virtual bool GRT::WeakClassifier::train ( ClassificationData trainingData,
VectorDouble &  weights 
)
inlinevirtual

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

Parameters
ClassificationData&trainingData: a reference to the training data that will be used to train the weak classifier model
VectorDouble&weights: the 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 GRT::RadialBasisFunction, and GRT::DecisionStump.

Definition at line 96 of file WeakClassifier.h.


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