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::MultidimensionalRegression Class Reference
Inheritance diagram for GRT::MultidimensionalRegression:
GRT::Regressifier GRT::MLBase GRT::GRTBase GRT::Observer< TrainingResult > GRT::Observer< TestInstanceResult >

Public Member Functions

 MultidimensionalRegression (const Regressifier &regressifier=LinearRegression(), bool useScaling=false)
 
virtual ~MultidimensionalRegression (void)
 
MultidimensionalRegressionoperator= (const MultidimensionalRegression &rhs)
 
virtual bool deepCopyFrom (const Regressifier *regressifier)
 
virtual bool train_ (RegressionData &trainingData)
 
virtual bool predict_ (VectorDouble &inputVector)
 
virtual bool saveModelToFile (fstream &file) const
 
virtual bool loadModelFromFile (fstream &file)
 
bool getIsRegressionModuleSet () const
 
RegressifiergetRegressifier () const
 
bool setRegressionModule (const Regressifier &regressifier)
 
- Public Member Functions inherited from GRT::Regressifier
 Regressifier (void)
 
virtual ~Regressifier (void)
 
bool copyBaseVariables (const Regressifier *regressifier)
 
virtual bool reset ()
 
virtual bool clear ()
 
string getRegressifierType () const
 
VectorDouble getRegressionData () const
 
vector< MinMaxgetInputRanges () const
 
vector< MinMaxgetOutputRanges () const
 
RegressifiercreateNewInstance () const
 
RegressifierdeepCopy () const
 
const RegressifiergetBaseRegressifier () const
 
- Public Member Functions inherited from GRT::MLBase
 MLBase (void)
 
virtual ~MLBase (void)
 
bool copyMLBaseVariables (const MLBase *mlBase)
 
virtual bool train (ClassificationData trainingData)
 
virtual bool train_ (ClassificationData &trainingData)
 
virtual bool train (RegressionData trainingData)
 
virtual bool train (TimeSeriesClassificationData trainingData)
 
virtual bool train_ (TimeSeriesClassificationData &trainingData)
 
virtual bool train (TimeSeriesClassificationDataStream trainingData)
 
virtual bool train_ (TimeSeriesClassificationDataStream &trainingData)
 
virtual bool train (UnlabelledData trainingData)
 
virtual bool train_ (UnlabelledData &trainingData)
 
virtual bool train (MatrixDouble data)
 
virtual bool train_ (MatrixDouble &data)
 
virtual bool predict (VectorDouble inputVector)
 
virtual bool predict (MatrixDouble inputMatrix)
 
virtual bool predict_ (MatrixDouble &inputMatrix)
 
virtual bool map (VectorDouble inputVector)
 
virtual bool map_ (VectorDouble &inputVector)
 
virtual bool print () const
 
virtual bool save (const string filename) const
 
virtual bool load (const string filename)
 
virtual bool saveModelToFile (string filename) const
 
virtual bool loadModelFromFile (string filename)
 
virtual bool getModel (ostream &stream) const
 
double scale (const double &x, const double &minSource, const double &maxSource, const double &minTarget, const double &maxTarget, const bool constrain=false)
 
virtual string getModelAsString () const
 
UINT getBaseType () const
 
UINT getNumInputFeatures () const
 
UINT getNumInputDimensions () const
 
UINT getNumOutputDimensions () const
 
UINT getMinNumEpochs () const
 
UINT getMaxNumEpochs () const
 
UINT getValidationSetSize () const
 
UINT getNumTrainingIterationsToConverge () const
 
double getMinChange () const
 
double getLearningRate () const
 
double getRootMeanSquaredTrainingError () const
 
double getTotalSquaredTrainingError () const
 
bool getUseValidationSet () const
 
bool getRandomiseTrainingOrder () const
 
bool getTrained () const
 
bool getModelTrained () const
 
bool getScalingEnabled () const
 
bool getIsBaseTypeClassifier () const
 
bool getIsBaseTypeRegressifier () const
 
bool getIsBaseTypeClusterer () const
 
bool enableScaling (bool useScaling)
 
bool setMaxNumEpochs (const UINT maxNumEpochs)
 
bool setMinNumEpochs (const UINT minNumEpochs)
 
bool setMinChange (const double minChange)
 
bool setLearningRate (double learningRate)
 
bool setUseValidationSet (const bool useValidationSet)
 
bool setValidationSetSize (const UINT validationSetSize)
 
bool setRandomiseTrainingOrder (const bool randomiseTrainingOrder)
 
bool registerTrainingResultsObserver (Observer< TrainingResult > &observer)
 
bool registerTestResultsObserver (Observer< TestInstanceResult > &observer)
 
bool removeTrainingResultsObserver (const Observer< TrainingResult > &observer)
 
bool removeTestResultsObserver (const Observer< TestInstanceResult > &observer)
 
bool removeAllTrainingObservers ()
 
bool removeAllTestObservers ()
 
bool notifyTrainingResultsObservers (const TrainingResult &data)
 
bool notifyTestResultsObservers (const TestInstanceResult &data)
 
MLBasegetMLBasePointer ()
 
const MLBasegetMLBasePointer () const
 
vector< TrainingResultgetTrainingResults () const
 
- Public Member Functions inherited from GRT::GRTBase
 GRTBase (void)
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
string getClassType () const
 
string getLastWarningMessage () const
 
string getLastErrorMessage () const
 
string getLastInfoMessage () const
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 
- Public Member Functions inherited from GRT::Observer< TrainingResult >
virtual void notify (const TrainingResult &data)
 
- Public Member Functions inherited from GRT::Observer< TestInstanceResult >
virtual void notify (const TestInstanceResult &data)
 

Protected Member Functions

bool deepCopyRegressionModules (vector< Regressifier * > &newModules) const
 
bool deleteAll ()
 
bool deleteRegressionModules ()
 
bool loadLegacyModelFromFile (fstream &file)
 
- Protected Member Functions inherited from GRT::Regressifier
bool saveBaseSettingsToFile (fstream &file) const
 
bool loadBaseSettingsFromFile (fstream &file)
 
- Protected Member Functions inherited from GRT::MLBase
bool saveBaseSettingsToFile (fstream &file) const
 
bool loadBaseSettingsFromFile (fstream &file)
 
- Protected Member Functions inherited from GRT::GRTBase
double SQR (const double &x) const
 

Protected Attributes

Regressifierregressifier
 
vector< Regressifier * > regressionModules
 
- Protected Attributes inherited from GRT::Regressifier
string regressifierType
 
VectorDouble regressionData
 
vector< MinMaxinputVectorRanges
 
vector< MinMaxtargetVectorRanges
 
- Protected Attributes inherited from GRT::MLBase
bool trained
 
bool useScaling
 
UINT baseType
 
UINT numInputDimensions
 
UINT numOutputDimensions
 
UINT numTrainingIterationsToConverge
 
UINT minNumEpochs
 
UINT maxNumEpochs
 
UINT validationSetSize
 
double learningRate
 
double minChange
 
double rootMeanSquaredTrainingError
 
double totalSquaredTrainingError
 
bool useValidationSet
 
bool randomiseTrainingOrder
 
Random random
 
vector< TrainingResulttrainingResults
 
TrainingResultsObserverManager trainingResultsObserverManager
 
TestResultsObserverManager testResultsObserverManager
 
- Protected Attributes inherited from GRT::GRTBase
string classType
 
DebugLog debugLog
 
ErrorLog errorLog
 
InfoLog infoLog
 
TrainingLog trainingLog
 
TestingLog testingLog
 
WarningLog warningLog
 

Static Protected Attributes

static RegisterRegressifierModule< MultidimensionalRegressionregisterModule
 

Additional Inherited Members

- Public Types inherited from GRT::Regressifier
typedef std::map< string, Regressifier *(*)() > StringRegressifierMap
 
- Public Types inherited from GRT::MLBase
enum  BaseTypes { BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER }
 
- Static Public Member Functions inherited from GRT::Regressifier
static RegressifiercreateInstanceFromString (string const &regressifierType)
 
static vector< string > getRegisteredRegressifiers ()
 
- Static Public Member Functions inherited from GRT::GRTBase
static string getGRTVersion (bool returnRevision=true)
 
static string getGRTRevison ()
 
- Static Protected Member Functions inherited from GRT::Regressifier
static StringRegressifierMapgetMap ()
 

Detailed Description

Definition at line 47 of file MultidimensionalRegression.h.

Constructor & Destructor Documentation

GRT::MultidimensionalRegression::MultidimensionalRegression ( const Regressifier regressifier = LinearRegression(),
bool  useScaling = false 
)

Default Constructor

Parameters
booluseScaling: sets if the training and real-time data should be scaled between [0 1]. Default value = false

Definition at line 28 of file MultidimensionalRegression.cpp.

GRT::MultidimensionalRegression::~MultidimensionalRegression ( void  )
virtual

Default Destructor

Definition at line 41 of file MultidimensionalRegression.cpp.

Member Function Documentation

bool GRT::MultidimensionalRegression::deepCopyFrom ( const Regressifier regressifier)
virtual

This is required for the Gesture Recognition Pipeline for when the pipeline.setRegressifier(...) method is called. It clones the data from the Base Class Regressifier pointer (which should be pointing to an Multidimensional Regressioninstance) into this instance

Parameters
Regressifier*regressifier: a pointer to the Regressifier Base Class, this should be pointing to another Multidimensional Regression instance
Returns
returns true if the clone was successfull, false otherwise

Reimplemented from GRT::Regressifier.

Definition at line 67 of file MultidimensionalRegression.cpp.

bool GRT::MultidimensionalRegression::getIsRegressionModuleSet ( ) const

This returns true if the regression module has been set. The regression module is the regression algorithm that will be used when the user attempts to train N regression models.

A regression module must be set before a regression model can be trained.

Returns
returns true if the regression module has been set, false otherwise

Definition at line 320 of file MultidimensionalRegression.cpp.

Regressifier * GRT::MultidimensionalRegression::getRegressifier ( ) const

This returns a pointer to the regression module. If no regression module has been set, then this function will return NULL.

Returns
returns a pointer to the regression module if it has been set, or NULL otherwise

Definition at line 324 of file MultidimensionalRegression.cpp.

bool GRT::MultidimensionalRegression::loadLegacyModelFromFile ( fstream &  file)
protected

Read the ranges if needed

Definition at line 396 of file MultidimensionalRegression.cpp.

bool GRT::MultidimensionalRegression::loadModelFromFile ( fstream &  file)
virtual

This loads a trained Multidimensional Regression model from a file. This overrides the loadModelFromFile function in the ML base class.

Parameters
fstream&file: a reference to the file the Logistic Regression model will be loaded from
Returns
returns true if the model was loaded successfully, false otherwise

Reimplemented from GRT::MLBase.

Definition at line 245 of file MultidimensionalRegression.cpp.

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

Defines how the data from the rhs MultidimensionalRegression should be copied to this MultidimensionalRegression

Parameters
constLRC &rhs: another instance of a MultidimensionalRegression
Returns
returns a pointer to this instance of the MultidimensionalRegression

Definition at line 46 of file MultidimensionalRegression.cpp.

bool GRT::MultidimensionalRegression::predict_ ( VectorDouble &  inputVector)
virtual

This performs the regression by mapping the inputVector using the current Multidimensional Regression model. This overrides the predict function in the ML base class.

Parameters
VectorDouble&inputVector: the input vector to classify
Returns
returns true if the prediction was performed, false otherwise

Reimplemented from GRT::MLBase.

Definition at line 169 of file MultidimensionalRegression.cpp.

bool GRT::MultidimensionalRegression::saveModelToFile ( fstream &  file) const
virtual

This saves the trained Multidimensional Regression model to a file. This overrides the saveModelToFile function in the ML base class.

Parameters
fstream&file: a reference to the file the Multidimensional Regression model will be saved to
Returns
returns true if the model was saved successfully, false otherwise

Reimplemented from GRT::MLBase.

Definition at line 205 of file MultidimensionalRegression.cpp.

bool GRT::MultidimensionalRegression::setRegressionModule ( const Regressifier regressifier)

Sets the regression module that will be used the next time a user attempts to train a regression module.

Parameters
constRegressifier &regressifier: a reference to a regression module that will be copied and used the next time the user attempts to train a regression module
Returns
returns true if the regresion module was set successfully, false otherwise

Definition at line 328 of file MultidimensionalRegression.cpp.

bool GRT::MultidimensionalRegression::train_ ( RegressionData trainingData)
virtual

This trains the Multidimensional Regression model, using the labelled regression data. This overrides the train function in the ML base class.

Parameters
RegressionData&trainingData: the training data that will be used to train the regression model
Returns
returns true if the Multidimensional Regression model was trained, false otherwise

Reimplemented from GRT::MLBase.

Definition at line 91 of file MultidimensionalRegression.cpp.


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