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.
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  BaseType {
  BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER,
  PRE_PROCSSING, POST_PROCESSING, FEATURE_EXTRACTION, CONTEXT
}
 

Public Member Functions

 Regressifier (const std::string &id="")
 
virtual ~Regressifier (void)
 
virtual bool deepCopyFrom (const Regressifier *regressifier)
 
bool copyBaseVariables (const Regressifier *regressifier)
 
virtual bool reset () override
 
virtual bool clear () override
 
VectorFloat getRegressionData () const
 
Vector< MinMaxgetInputRanges () const
 
Vector< MinMaxgetOutputRanges () const
 
RegressifierdeepCopy () const
 
const RegressifiergetBaseRegressifier () const
 
Regressifiercreate () const
 
 GRT_DEPRECATED_MSG ("createNewInstance is deprecated, use create() instead.", Regressifier *createNewInstance() const )
 
 GRT_DEPRECATED_MSG ("createInstanceFromString(id) is deprecated, use create(id) instead.", static Regressifier *createInstanceFromString(const std::string &id))
 
 GRT_DEPRECATED_MSG ("getRegressifierType is deprecated, use getId() instead", std::string getRegressifierType() const )
 
- Public Member Functions inherited from MLBase
 MLBase (const std::string &id="", const BaseType type=BASE_TYPE_NOT_SET)
 
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 (RegressionData trainingData, RegressionData validationData)
 
virtual bool train_ (RegressionData &trainingData, RegressionData &validationData)
 
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(const std::string &filename) instead", virtual bool saveModelToFile(const 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(const std::string &filename) instead", virtual bool loadModelFromFile(const 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
 
virtual std::string getModelAsString () const
 
DataType getInputType () const
 
DataType getOutputType () const
 
BaseType getType () const
 
UINT getNumInputFeatures () const
 
UINT getNumInputDimensions () const
 
UINT getNumOutputDimensions () const
 
UINT getMinNumEpochs () const
 
UINT getMaxNumEpochs () const
 
UINT getBatchSize () const
 
UINT getNumRestarts () const
 
UINT getValidationSetSize () const
 
UINT getNumTrainingIterationsToConverge () const
 
Float getMinChange () const
 
Float getLearningRate () const
 
Float getRMSTrainingError () const
 
 GRT_DEPRECATED_MSG ("getRootMeanSquaredTrainingError() is deprecated, use getRMSTrainingError() instead", Float getRootMeanSquaredTrainingError() const )
 
Float getTotalSquaredTrainingError () const
 
Float getRMSValidationError () const
 
Float getValidationSetAccuracy () const
 
VectorFloat getValidationSetPrecision () const
 
VectorFloat getValidationSetRecall () const
 
bool getUseValidationSet () const
 
bool getRandomiseTrainingOrder () const
 
bool getTrained () const
 
 GRT_DEPRECATED_MSG ("getModelTrained() is deprecated, use getTrained() instead", bool getModelTrained() const )
 
bool getConverged () const
 
bool getScalingEnabled () const
 
bool getIsBaseTypeClassifier () const
 
bool getIsBaseTypeRegressifier () const
 
bool getIsBaseTypeClusterer () const
 
bool getTrainingLoggingEnabled () const
 
bool getTestingLoggingEnabled () const
 
bool enableScaling (const bool useScaling)
 
bool setMaxNumEpochs (const UINT maxNumEpochs)
 
bool setBatchSize (const UINT batchSize)
 
bool setMinNumEpochs (const UINT minNumEpochs)
 
bool setNumRestarts (const UINT numRestarts)
 
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 setTestingLoggingEnabled (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< TrainingResultgetTrainingResults () const
 
- Public Member Functions inherited from GRTBase
 GRTBase (const std::string &id="")
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
 GRT_DEPRECATED_MSG ("getClassType is deprecated, use getId() instead!", std::string getClassType() const )
 
std::string getId () 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)
 
bool setDebugLoggingEnabled (const bool loggingEnabled)
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 
Float scale (const Float &x, const Float &minSource, const Float &maxSource, const Float &minTarget, const Float &maxTarget, const bool constrain=false)
 
Float SQR (const Float &x) 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 Vector< std::string > getRegisteredRegressifiers ()
 
static Regressifiercreate (const std::string &id)
 
- 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)
 

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
 
bool converged
 
DataType inputType
 
DataType outputType
 
BaseType baseType
 
UINT numInputDimensions
 
UINT numOutputDimensions
 
UINT numTrainingIterationsToConverge
 
UINT minNumEpochs
 
UINT maxNumEpochs
 
UINT batchSize
 
UINT validationSetSize
 
UINT numRestarts
 
Float learningRate
 
Float minChange
 
Float rmsTrainingError
 
Float rmsValidationError
 
Float totalSquaredTrainingError
 
Float validationSetAccuracy
 
bool useValidationSet
 
bool randomiseTrainingOrder
 
VectorFloat validationSetPrecision
 
VectorFloat validationSetRecall
 
Random random
 
Vector< TrainingResulttrainingResults
 
TrainingResultsObserverManager trainingResultsObserverManager
 
TestResultsObserverManager testResultsObserverManager
 
TrainingLog trainingLog
 
TestingLog testingLog
 
- Protected Attributes inherited from GRTBase
std::string classId
 Stores the name of the class (e.g., MinDist)
 
DebugLog debugLog
 
ErrorLog errorLog
 
InfoLog infoLog
 
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 113 of file Regressifier.h.

Constructor & Destructor Documentation

Regressifier::Regressifier ( const std::string &  id = "")

Default Regressifier Destructor

Parameters
ida unique string that identifies the Regressifier parent class (e.g., LinearRegression)

Definition at line 60 of file Regressifier.cpp.

Regressifier::~Regressifier ( void  )
virtual

Default Regressifier Destructor

Definition at line 66 of file Regressifier.cpp.

Member Function Documentation

bool Regressifier::clear ( )
overridevirtual

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 MLP, and RegressionTree.

Definition at line 111 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 84 of file Regressifier.cpp.

Regressifier * Regressifier::create ( const std::string &  id)
static

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

Parameters
idthe id of the regressifier
Returns
a pointer to the new instance of the regressifier

Definition at line 34 of file Regressifier.cpp.

Regressifier * Regressifier::create ( ) 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 43 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 47 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 MultidimensionalRegression, RegressionTree, LogisticRegression, MLP, and LinearRegression.

Definition at line 64 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
a reference to this regressifier

Definition at line 139 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 131 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 135 of file Regressifier.cpp.

Vector< std::string > Regressifier::getRegisteredRegressifiers ( )
static

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

Returns
a Vector containing the names of the regressifiers that have been registered with the base regressifier

Definition at line 73 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 124 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 168 of file Regressifier.cpp.

bool Regressifier::reset ( )
overridevirtual

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 103 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 143 of file Regressifier.cpp.


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