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

Public Types

typedef std::map< std::string, Regressifier *(*)() > StringRegressifierMap
 
- Public Types inherited from 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 ()
 
std::string getRegressifierType () const
 
VectorFloat getRegressionData () const
 
Vector< MinMaxgetInputRanges () const
 
Vector< MinMaxgetOutputRanges () const
 
RegressifiercreateNewInstance () const
 
RegressifierdeepCopy () const
 
const RegressifiergetBaseRegressifier () const
 
- Public Member Functions inherited from 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 (ClassificationDataStream trainingData)
 
virtual bool train_ (ClassificationDataStream &trainingData)
 
virtual bool train (UnlabelledData trainingData)
 
virtual bool train_ (UnlabelledData &trainingData)
 
virtual bool train (MatrixFloat data)
 
virtual bool train_ (MatrixFloat &data)
 
virtual bool predict (VectorFloat inputVector)
 
virtual bool predict_ (VectorFloat &inputVector)
 
virtual bool predict (MatrixFloat inputMatrix)
 
virtual bool predict_ (MatrixFloat &inputMatrix)
 
virtual bool map (VectorFloat inputVector)
 
virtual bool map_ (VectorFloat &inputVector)
 
virtual bool print () const
 
virtual bool save (const std::string filename) const
 
virtual bool load (const std::string filename)
 
virtual bool save (std::fstream &file) const
 
virtual bool load (std::fstream &file)
 
 GRT_DEPRECATED_MSG ("saveModelToFile(std::string filename) is deprecated, use save(std::string filename) instead", virtual bool saveModelToFile(std::string filename) const )
 
 GRT_DEPRECATED_MSG ("saveModelToFile(std::fstream &file) is deprecated, use save(std::fstream &file) instead", virtual bool saveModelToFile(std::fstream &file) const )
 
 GRT_DEPRECATED_MSG ("loadModelFromFile(std::string filename) is deprecated, use load(std::string filename) instead", virtual bool loadModelFromFile(std::string filename))
 
 GRT_DEPRECATED_MSG ("loadModelFromFile(std::fstream &file) is deprecated, use load(std::fstream &file) instead", virtual bool loadModelFromFile(std::fstream &file))
 
virtual bool getModel (std::ostream &stream) const
 
Float scale (const Float &x, const Float &minSource, const Float &maxSource, const Float &minTarget, const Float &maxTarget, const bool constrain=false)
 
virtual std::string getModelAsString () const
 
DataType getInputType () const
 
DataType getOutputType () 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
 
Float getMinChange () const
 
Float getLearningRate () const
 
Float getRootMeanSquaredTrainingError () const
 
Float getTotalSquaredTrainingError () const
 
Float getValidationSetAccuracy () const
 
VectorFloat getValidationSetPrecision () const
 
VectorFloat getValidationSetRecall () 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 (const bool useScaling)
 
bool setMaxNumEpochs (const UINT maxNumEpochs)
 
bool setMinNumEpochs (const UINT minNumEpochs)
 
bool setMinChange (const Float minChange)
 
bool setLearningRate (const Float learningRate)
 
bool setUseValidationSet (const bool useValidationSet)
 
bool setValidationSetSize (const UINT validationSetSize)
 
bool setRandomiseTrainingOrder (const bool randomiseTrainingOrder)
 
bool setTrainingLoggingEnabled (const bool loggingEnabled)
 
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< TrainingResult > getTrainingResults () const
 
- Public Member Functions inherited from GRTBase
 GRTBase (void)
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
std::string getClassType () const
 
std::string getLastWarningMessage () const
 
std::string getLastErrorMessage () const
 
std::string getLastInfoMessage () const
 
bool setInfoLoggingEnabled (const bool loggingEnabled)
 
bool setWarningLoggingEnabled (const bool loggingEnabled)
 
bool setErrorLoggingEnabled (const bool loggingEnabled)
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 
- Public Member Functions inherited from Observer< TrainingResult >
virtual void notify (const TrainingResult &data)
 
- Public Member Functions inherited from Observer< TestInstanceResult >
virtual void notify (const TestInstanceResult &data)
 

Static Public Member Functions

static RegressifiercreateInstanceFromString (const std::string &regressifierType)
 
static Vector< std::string > getRegisteredRegressifiers ()
 
- Static Public Member Functions inherited from GRTBase
static std::string getGRTVersion (bool returnRevision=true)
 
static std::string getGRTRevison ()
 

Protected Member Functions

bool saveBaseSettingsToFile (std::fstream &file) const
 
bool loadBaseSettingsFromFile (std::fstream &file)
 
- Protected Member Functions inherited from MLBase
bool saveBaseSettingsToFile (std::fstream &file) const
 
bool loadBaseSettingsFromFile (std::fstream &file)
 
- Protected Member Functions inherited from GRTBase
Float SQR (const Float &x) const
 

Static Protected Member Functions

static StringRegressifierMapgetMap ()
 

Protected Attributes

std::string regressifierType
 
VectorFloat regressionData
 
Vector< MinMaxinputVectorRanges
 
Vector< MinMaxtargetVectorRanges
 
- Protected Attributes inherited from MLBase
bool trained
 
bool useScaling
 
DataType inputType
 
DataType outputType
 
UINT baseType
 
UINT numInputDimensions
 
UINT numOutputDimensions
 
UINT numTrainingIterationsToConverge
 
UINT minNumEpochs
 
UINT maxNumEpochs
 
UINT validationSetSize
 
Float learningRate
 
Float minChange
 
Float rootMeanSquaredTrainingError
 
Float totalSquaredTrainingError
 
Float validationSetAccuracy
 
bool useValidationSet
 
bool randomiseTrainingOrder
 
VectorFloat validationSetPrecision
 
VectorFloat validationSetRecall
 
Random random
 
std::vector< TrainingResult > trainingResults
 
TrainingResultsObserverManager trainingResultsObserverManager
 
TestResultsObserverManager testResultsObserverManager
 
- Protected Attributes inherited from GRTBase
std::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< std::string, Regressifier*(*)() > 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

Regressifier::Regressifier ( void  )

Default Regressifier Destructor

Definition at line 55 of file Regressifier.cpp.

Regressifier::~Regressifier ( void  )
virtual

Default Regressifier Destructor

Definition at line 62 of file Regressifier.cpp.

Member Function Documentation

bool 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 MLBase.

Reimplemented in RegressionTree, and MLP.

Definition at line 98 of file Regressifier.cpp.

bool Regressifier::copyBaseVariables ( const Regressifier regressifier)

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

Parameters
regressifiera 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 69 of file Regressifier.cpp.

Regressifier * Regressifier::createInstanceFromString ( const std::string &  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
regressifierTypethe name of the regressifier
Returns
Regressifier*: a pointer to the new instance of the regressifier

Definition at line 29 of file Regressifier.cpp.

Regressifier * 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 38 of file Regressifier.cpp.

Regressifier * 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 42 of file Regressifier.cpp.

virtual bool 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
regressifiera 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 RegressionTree, MultidimensionalRegression, MLP, LinearRegression, and LogisticRegression.

Definition at line 63 of file Regressifier.h.

const Regressifier & 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 132 of file Regressifier.cpp.

Vector< MinMax > 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 124 of file Regressifier.cpp.

Vector< MinMax > 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 128 of file Regressifier.cpp.

static Vector< std::string > 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
std::string 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 113 of file Regressifier.cpp.

VectorFloat 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 117 of file Regressifier.cpp.

bool Regressifier::loadBaseSettingsFromFile ( std::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 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 MLBase.

Definition at line 88 of file Regressifier.cpp.

bool Regressifier::saveBaseSettingsToFile ( std::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 136 of file Regressifier.cpp.


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