GestureRecognitionToolkit  Version: 0.2.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
RadialBasisFunction Class Reference

#include <RadialBasisFunction.h>

Inheritance diagram for RadialBasisFunction:
WeakClassifier

Public Member Functions

 RadialBasisFunction (UINT numSteps=100, Float positiveClassificationThreshold=0.9, Float minAlphaSearchRange=0.001, Float maxAlphaSearchRange=1.0)
 
virtual ~RadialBasisFunction ()
 
 RadialBasisFunction (const RadialBasisFunction &rhs)
 
RadialBasisFunctionoperator= (const RadialBasisFunction &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 getNumSteps () const
 
Float getPositiveClassificationThreshold () const
 
Float getAlpha () const
 
Float getMinAlphaSearchRange () const
 
Float getMaxAlphaSearchRange () const
 
VectorFloat getRBFCentre () 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
 
WeakClassifiercreateNewInstance () const
 

Protected Member Functions

Float rbf (const VectorFloat &a, const VectorFloat &b)
 

Protected Attributes

UINT numSteps
 
Float positiveClassificationThreshold
 
Float alpha
 
Float gamma
 
Float minAlphaSearchRange
 
Float maxAlphaSearchRange
 
VectorFloat rbfCentre
 
- 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< RadialBasisFunctionregisterModule
 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.

Definition at line 40 of file RadialBasisFunction.h.

Constructor & Destructor Documentation

RadialBasisFunction::RadialBasisFunction ( UINT  numSteps = 100,
Float  positiveClassificationThreshold = 0.9,
Float  minAlphaSearchRange = 0.001,
Float  maxAlphaSearchRange = 1.0 
)

Default Constructor.

Sets the number of steps that will be used to search for the best alpha value during the training phase, in addition to other parameters used to control the RBF learning algorithm.

Parameters
numStepssets the number of steps that will be used to search for the best alpha value during the training phase. Default value = 100
positiveClassificationThresholdsets the positive classification threshold, this parameter is the threshold that defines if a value is classified as a positive sample or a negative sample. Default value = 0.9
minAlphaSearchRangethe minimum value used to search for the best alpha value. Default value = 0.001
maxAlphaSearchRangethe maximum value used to search for the best alpha value. Default value = 1.0

Definition at line 36 of file RadialBasisFunction.cpp.

RadialBasisFunction::~RadialBasisFunction ( )
virtual

Default Destructor.

Definition at line 51 of file RadialBasisFunction.cpp.

RadialBasisFunction::RadialBasisFunction ( const RadialBasisFunction rhs)

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

Definition at line 55 of file RadialBasisFunction.cpp.

Member Function Documentation

bool RadialBasisFunction::deepCopyFrom ( const WeakClassifier weakClassifer)
virtual

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

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

Reimplemented from WeakClassifier.

Definition at line 73 of file RadialBasisFunction.cpp.

Float RadialBasisFunction::getAlpha ( ) const

Gets the current alpha value, this is used in the RBF. You can compute the RBF gamma parameter by: -1.0/(2.0*SQR(alpha)).

Returns
returns the alpha value

Definition at line 336 of file RadialBasisFunction.cpp.

Float RadialBasisFunction::getMaxAlphaSearchRange ( ) const

Gets the maxAlphaSearchRange value, this is the maximum value used to search for the best alpha value.

Returns
returns the maxAlphaSearchRange value

Definition at line 344 of file RadialBasisFunction.cpp.

Float RadialBasisFunction::getMinAlphaSearchRange ( ) const

Gets the minAlphaSearchRange value, this is the minimum value used to search for the best alpha value.

Returns
returns the minAlphaSearchRange value

Definition at line 340 of file RadialBasisFunction.cpp.

UINT RadialBasisFunction::getNumSteps ( ) const

This function gets the number of steps parameter which sets how many steps are used to search for the best RBF alpha values.

Returns
returns an UINT representing the numSteps parameter

Definition at line 328 of file RadialBasisFunction.cpp.

Float RadialBasisFunction::getPositiveClassificationThreshold ( ) const

This function gets the positiveClassificationThreshold, if the output of the RBF function is greater than or equal to the positiveClassificationThreshold then the input sample will be classified as a positive sample, otherwise it will be classified as a negative sample.

Returns
returns the positiveClassificationThreshold

Definition at line 332 of file RadialBasisFunction.cpp.

VectorFloat RadialBasisFunction::getRBFCentre ( ) const

Gets the RBF center.

Returns
returns the RBF centre.

Definition at line 324 of file RadialBasisFunction.cpp.

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

This function loads an RBF model from a file.

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

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

Reimplemented from WeakClassifier.

Definition at line 231 of file RadialBasisFunction.cpp.

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

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

Definition at line 59 of file RadialBasisFunction.cpp.

Float RadialBasisFunction::predict ( const VectorFloat x)
virtual

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

Parameters
xthe vector used for prediction
Returns
returns the predicted class label, which will be either positive or negative

Reimplemented from WeakClassifier.

Definition at line 185 of file RadialBasisFunction.cpp.

void RadialBasisFunction::print ( ) const
virtual

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

Reimplemented from WeakClassifier.

Definition at line 321 of file RadialBasisFunction.cpp.

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

This function saves the current RBF model to a file.

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

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

Reimplemented from WeakClassifier.

Definition at line 200 of file RadialBasisFunction.cpp.

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

This function trains the RBF, 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 RBF was trained successfull, false otherwise

Reimplemented from WeakClassifier.

Definition at line 84 of file RadialBasisFunction.cpp.


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