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.
DecisionStump Class Reference

#include <DecisionStump.h>

Inheritance diagram for DecisionStump:
WeakClassifier

Public Member Functions

 DecisionStump (const UINT numRandomSplits=100)
 
virtual ~DecisionStump ()
 
 DecisionStump (const DecisionStump &rhs)
 
DecisionStumpoperator= (const DecisionStump &rhs)
 
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
 
UINT getDecisionFeatureIndex () const
 
UINT getDirection () const
 
UINT getNumRandomSplits () const
 
Float getDecisionValue () const
 
- Public Member Functions inherited from WeakClassifier
 WeakClassifier ()
 
virtual ~WeakClassifier ()
 
 WeakClassifier (const WeakClassifier &rhs)
 
WeakClassifieroperator= (const WeakClassifier &rhs)
 
bool copyBaseVariables (const WeakClassifier *weakClassifer)
 
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
 

Protected Attributes

UINT decisionFeatureIndex
 The dimension that the data will be spilt on.
 
UINT direction
 Indicates if the decision spilt threshold is greater than (1), or less than (0)
 
UINT numRandomSplits
 The number of random splits used to search for the best decision spilt.
 
Float decisionValue
 The decision spilt threshold.
 
- Protected Attributes inherited from WeakClassifier
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
 

Static Protected Attributes

static RegisterWeakClassifierModule< DecisionStumpregisterModule
 This is used to register the DecisionStump with the WeakClassifier base class.
 

Additional Inherited Members

- Public Types inherited from WeakClassifier
typedef std::map< std::string, WeakClassifier *(*)() > StringWeakClassifierMap
 
- Static Public Member Functions inherited from WeakClassifier
static WeakClassifiercreateInstanceFromString (std::string const &weakClassifierType)
 
- Static Protected Member Functions inherited from WeakClassifier
static StringWeakClassifierMapgetMap ()
 

Detailed Description

GRT MIT License Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Examples:
ClassificationModulesExamples/AdaBoostExample/AdaBoostExample.cpp.

Definition at line 36 of file DecisionStump.h.

Constructor & Destructor Documentation

DecisionStump::DecisionStump ( const UINT  numRandomSplits = 100)

Default Constructor.

Sets the number of random splits that will be used to search for the best split value.

Parameters
numRandomSplitssets the number of random splits that will be used to search for the best split value. Default value = 100

Definition at line 36 of file DecisionStump.cpp.

DecisionStump::~DecisionStump ( )
virtual

Default Destructor.

Definition at line 49 of file DecisionStump.cpp.

DecisionStump::DecisionStump ( const DecisionStump rhs)

Default Copy Constructor. Defines how the data from the rhs GRT::DecisionStump instance is copied to this GRT::DecisionStump instance.

Definition at line 53 of file DecisionStump.cpp.

Member Function Documentation

bool DecisionStump::deepCopyFrom ( const WeakClassifier weakClassifer)
virtual

This function enables the data from one GRT::DecisionStump instance to be copied into this GRT::DecisionStump instance.

Parameters
weakClassifera pointer to the Classifier Base Class, this should be pointing to another GRT::DecisionStump instance
Returns
returns true if the clone was successfull, false otherwise

Reimplemented from WeakClassifier.

Definition at line 68 of file DecisionStump.cpp.

UINT DecisionStump::getDecisionFeatureIndex ( ) const
Returns
returns the index of the feature that is used to split the data into a positive or negative class

Definition at line 255 of file DecisionStump.cpp.

Float DecisionStump::getDecisionValue ( ) const
Returns
returns the decision spilt threshold

Definition at line 267 of file DecisionStump.cpp.

UINT DecisionStump::getDirection ( ) const
Returns
returns if the decision spilt threshold is greater than (1), or less than (0)

Definition at line 259 of file DecisionStump.cpp.

UINT DecisionStump::getNumRandomSplits ( ) const
Returns
returns the number of random splits that will be used to search for the best decision spilt

Definition at line 263 of file DecisionStump.cpp.

bool DecisionStump::loadModelFromFile ( std::fstream &  file)
virtual

This function loads an model model from a file.

fstream file: a reference to the file you want to load the RBF model from

Returns
returns true if the model was loaded successfull, false otherwise

Reimplemented from WeakClassifier.

Definition at line 180 of file DecisionStump.cpp.

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

Defines how the data from the rhs GRT::DecisionStump instance is copied to this GRT::DecisionStump instance.

Definition at line 57 of file DecisionStump.cpp.

Float DecisionStump::predict ( const VectorFloat x)
virtual

This function predicts the class label of the input vector, given the current model. The class label returned will either be positive (WEAK_CLASSIFIER_POSITIVE_CLASS_LABEL) or negative (WEAK_CLASSIFIER_NEGATIVE_CLASS_LABEL).

Parameters
weightsa reference to the vector used for prediction
Returns
returns the estimated class label, which will be positive or negative

Reimplemented from WeakClassifier.

Definition at line 150 of file DecisionStump.cpp.

void DecisionStump::print ( ) const
virtual

This function prints out some basic info about the model to std::cout.

Reimplemented from WeakClassifier.

Definition at line 248 of file DecisionStump.cpp.

bool DecisionStump::saveModelToFile ( std::fstream &  file) const
virtual

This function saves the current model to a file.

fstream file: a reference to the file you want to save the RBF model to

Returns
returns true if the model was saved successfull, false otherwise

Reimplemented from WeakClassifier.

Definition at line 157 of file DecisionStump.cpp.

bool DecisionStump::train ( ClassificationData trainingData,
VectorFloat weights 
)
virtual

This function trains the DecisionStump model, using the weighted labelled training data.

Parameters
trainingDatathe labelled training data
weightsthe corresponding weights for each sample in the labelled training data
Returns
returns true if the model was trained successfull, false otherwise

Reimplemented from WeakClassifier.

Definition at line 78 of file DecisionStump.cpp.


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