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::Regressifier Class Reference
Inheritance diagram for GRT::Regressifier:
GRT::MLBase GRT::GRTBase GRT::Observer< TrainingResult > GRT::Observer< TestInstanceResult > GRT::LinearRegression GRT::LogisticRegression GRT::MLP GRT::MultidimensionalRegression GRT::RegisterRegressifierModule< T > GRT::RegressionTree GRT::RegisterRegressifierModule< GRT::LinearRegression > GRT::RegisterRegressifierModule< GRT::LogisticRegression > GRT::RegisterRegressifierModule< GRT::MLP > GRT::RegisterRegressifierModule< GRT::MultidimensionalRegression > GRT::RegisterRegressifierModule< GRT::RegressionTree >

Public Types

typedef std::map< string, Regressifier *(*)() > StringRegressifierMap
 
- Public Types inherited from GRT::MLBase
enum  BaseTypes { BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER }
 

Public Member Functions

 Regressifier (void)
 
virtual ~Regressifier (void)
 
virtual bool deepCopyFrom (const Regressifier *regressifier)
 
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_ (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_ (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 saveModelToFile (fstream &file) const
 
virtual bool loadModelFromFile (string filename)
 
virtual bool loadModelFromFile (fstream &file)
 
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)
 

Static Public Member Functions

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 ()
 

Protected Member Functions

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
 

Static Protected Member Functions

static StringRegressifierMapgetMap ()
 

Protected Attributes

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
 

Detailed Description

Definition at line 43 of file Regressifier.h.

Member Typedef Documentation

typedef std::map< string, Regressifier*(*)() > GRT::Regressifier::StringRegressifierMap

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

Definition at line 119 of file Regressifier.h.

Constructor & Destructor Documentation

GRT::Regressifier::Regressifier ( void  )

Default Regressifier Destructor

Definition at line 53 of file Regressifier.cpp.

GRT::Regressifier::~Regressifier ( void  )
virtual

Default Regressifier Destructor

Definition at line 60 of file Regressifier.cpp.

Member Function Documentation

bool GRT::Regressifier::clear ( )
virtual

This function clears the regressifier module, removing any trained model and setting all the base variables to their default values.

Returns
returns true if the module was cleared succesfully, false otherwise

Reimplemented from GRT::MLBase.

Reimplemented in GRT::RegressionTree, and GRT::MLP.

Definition at line 96 of file Regressifier.cpp.

bool GRT::Regressifier::copyBaseVariables ( const Regressifier regressifier)

This copies the Regressifier variables from the regressifier pointer to this instance.

Parameters
constRegressifier *regressifier: a pointer to a regressifier from which the values will be copied to this instance
Returns
returns true if the copy was successfull, false otherwise

Definition at line 67 of file Regressifier.cpp.

Regressifier * GRT::Regressifier::createInstanceFromString ( string const &  regressifierType)
static

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

Parameters
stringconst &regressifierType: the name of the regressifier
Returns
Regressifier*: a pointer to the new instance of the regressifier

Definition at line 27 of file Regressifier.cpp.

Regressifier * GRT::Regressifier::createNewInstance ( ) const

Creates a new regressifier instance based on the current regressifierType string value.

Returns
Regressifier*: a pointer to the new instance of the regressifier

Definition at line 36 of file Regressifier.cpp.

Regressifier * GRT::Regressifier::deepCopy ( ) const

This creates a new Regressifier instance and deep copies the variables and models from this instance into the deep copy. The function will then return a pointer to the new instance. It is up to the user who calls this function to delete the dynamic instance when they are finished using it.

Returns
returns a pointer to a new Regressifier instance which is a deep copy of this instance

Definition at line 40 of file Regressifier.cpp.

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

This is the base deep copy function for the Regressifier modules. This function should be overwritten by the derived class. This deep copies the variables and models from the regressifier pointer to this regressifier instance.

Parameters
constRegressifier *regressifier: a pointer to the Regressifier base class, this should be pointing to another instance of a matching derived class
Returns
returns true if the deep copy was successfull, false otherwise (the Regressifier base class will always return false)

Reimplemented in GRT::RegressionTree, GRT::MultidimensionalRegression, GRT::MLP, GRT::LinearRegression, and GRT::LogisticRegression.

Definition at line 63 of file Regressifier.h.

const Regressifier & GRT::Regressifier::getBaseRegressifier ( ) const

Returns a pointer to this regressifier. This is useful for a derived class so it can get easy access to this base regressifier.

Returns
Regressifier&: a reference to this regressifier

Definition at line 130 of file Regressifier.cpp.

vector< MinMax > GRT::Regressifier::getInputRanges ( ) const

Returns the ranges of the input (i.e. feature) data.

Returns
returns a vector of MinMax values representing the ranges of the input data

Definition at line 122 of file Regressifier.cpp.

vector< MinMax > GRT::Regressifier::getOutputRanges ( ) const

Returns the ranges of the output (i.e. target) data.

Returns
returns a vector of MinMax values representing the ranges of the target data

Definition at line 126 of file Regressifier.cpp.

static vector< string > GRT::Regressifier::getRegisteredRegressifiers ( )
static

Returns a vector of the names of all regressifiers that have been registered with the base regressifier.

Returns
vector< string >: a vector containing the names of the regressifiers that have been registered with the base regressifier
string GRT::Regressifier::getRegressifierType ( ) const

Gets the regressifier type as a string. This is the name of the regression algorithm, such as "LinearRegression".

Returns
returns the regressifier type as a string

Definition at line 111 of file Regressifier.cpp.

VectorDouble GRT::Regressifier::getRegressionData ( ) const

Gets a vector containing the regression data output by the regression algorithm, this will be an M-dimensional vector, where M is the number of output dimensions in the model.

Returns
returns a vector containing the regression data output by the regression algorithm, an empty vector will be returned if the model has not been trained

Definition at line 115 of file Regressifier.cpp.

bool GRT::Regressifier::loadBaseSettingsFromFile ( fstream &  file)
protected

Loads the core base settings from a file.

Returns
returns true if the base settings were loaded, false otherwise

Definition at line 161 of file Regressifier.cpp.

bool GRT::Regressifier::reset ( )
virtual

This resets the regressifier. This overrides the reset function in the MLBase base class.

Returns
returns true if the regressifier was reset, false otherwise

Reimplemented from GRT::MLBase.

Definition at line 86 of file Regressifier.cpp.

bool GRT::Regressifier::saveBaseSettingsToFile ( fstream &  file) const
protected

Saves the core base settings to a file.

Returns
returns true if the base settings were saved, false otherwise

Definition at line 135 of file Regressifier.cpp.


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