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

Public Member Functions

 ContinuousHiddenMarkovModel (const UINT downsampleFactor=5, const UINT delta=1, const bool autoEstimateSigma=true, const double sigma=10.0)
 
 ContinuousHiddenMarkovModel (const ContinuousHiddenMarkovModel &rhs)
 
ContinuousHiddenMarkovModeloperator= (const ContinuousHiddenMarkovModel &rhs)
 
virtual bool predict_ (VectorDouble &x)
 
virtual bool predict_ (MatrixDouble &obs)
 
virtual bool train_ (TimeSeriesClassificationSample &trainingData)
 
virtual bool reset ()
 
virtual bool clear ()
 
virtual bool saveModelToFile (fstream &file) const
 
virtual bool loadModelFromFile (fstream &file)
 
virtual bool print () const
 
UINT getNumStates () const
 
UINT getClassLabel () const
 
double getLoglikelihood () const
 
double getPhase () const
 
vector< UINT > getEstimatedStates () const
 
MatrixDouble getAlpha () const
 
bool setDownsampleFactor (const UINT downsampleFactor)
 
bool setModelType (const UINT modelType)
 
bool setDelta (const UINT delta)
 
bool setSigma (const double sigma)
 
bool setAutoEstimateSigma (const bool autoEstimateSigma)
 
- 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 (MatrixDouble inputMatrix)
 
virtual bool map (VectorDouble inputVector)
 
virtual bool map_ (VectorDouble &inputVector)
 
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

double gauss (const MatrixDouble &x, const MatrixDouble &y, const MatrixDouble &sigma, const unsigned int i, const unsigned int j, const unsigned int N)
 
- 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

UINT downsampleFactor
 
UINT numStates
 The number of states for this model.
 
UINT classLabel
 The class label associated with this model.
 
UINT timeseriesLength
 The length of the training timeseries.
 
bool autoEstimateSigma
 
double sigma
 
double phase
 
MatrixDouble a
 The transitions probability matrix.
 
MatrixDouble b
 The emissions probability matrix.
 
VectorDouble pi
 The state start probability vector.
 
MatrixDouble alpha
 
VectorDouble c
 
CircularBuffer< VectorDouble > observationSequence
 A buffer to store data for realtime prediction.
 
MatrixDouble obsSequence
 
vector< UINT > estimatedStates
 The estimated states for prediction.
 
MatrixDouble sigmaStates
 The sigma value for each state.
 
UINT modelType
 The model type (LEFTRIGHT, or ERGODIC)
 
UINT delta
 The number of states a model can move to in a LEFTRIGHT model.
 
double loglikelihood
 The log likelihood of an observation sequence given the modal, calculated by the forward method.
 
double cThreshold
 The classification threshold for this model.
 
- 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
 

Additional Inherited Members

- Public Types inherited from GRT::MLBase
enum  BaseTypes { BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER }
 
- Static Public Member Functions inherited from GRT::GRTBase
static string getGRTVersion (bool returnRevision=true)
 
static string getGRTRevison ()
 

Detailed Description

Definition at line 40 of file ContinuousHiddenMarkovModel.h.

Member Function Documentation

bool ContinuousHiddenMarkovModel::clear ( )
virtual

This is the main clear interface for all the GRT machine learning algorithms. It will completely clear the ML module, removing any trained model and setting all the base variables to their default values.

Returns
returns true if the derived class was cleared succesfully, false otherwise

Reimplemented from GRT::MLBase.

Definition at line 384 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::loadModelFromFile ( fstream &  file)
virtual

This loads a trained model from a file.

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

Reimplemented from GRT::MLBase.

Definition at line 579 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::predict_ ( VectorDouble &  inputVector)
virtual

This is the main prediction interface for all the GRT machine learning algorithms. This should be overwritten by the derived class.

Parameters
VectorDouble&inputVector: a reference to the input vector for prediction
Returns
returns true if the prediction was completed succesfully, false otherwise (the base class always returns false)

Reimplemented from GRT::MLBase.

Definition at line 109 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::predict_ ( MatrixDouble inputMatrix)
virtual

This is the prediction interface for time series data. This should be overwritten by the derived class.

Parameters
MatrixDoubleinputMatrix: a reference to the new input matrix for prediction
Returns
returns true if the prediction was completed succesfully, false otherwise (the base class always returns false)

Reimplemented from GRT::MLBase.

Definition at line 134 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::print ( ) const
virtual

This is the main print interface for all the GRT machine learning algorithms. This should be overwritten by the derived class. It will print the model and settings to the display log.

Returns
returns true if the model was printed succesfully, false otherwise (the base class always returns true)

Reimplemented from GRT::MLBase.

Definition at line 405 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::reset ( )
virtual

This is the main reset interface for all the GRT machine learning algorithms. It should be used to reset the model (i.e. set all values back to default settings). If you want to completely clear the model (i.e. clear any learned weights or values) then you should use the clear function.

Returns
returns true if the derived class was reset succesfully, false otherwise (the base class always returns true)

Reimplemented from GRT::MLBase.

Definition at line 370 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::saveModelToFile ( fstream &  file) const
virtual

This saves the trained model to a file.

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

Reimplemented from GRT::MLBase.

Definition at line 514 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::setDelta ( const UINT  delta)

This function sets the delta parameter in each HMM.

The delta value controls how many states a model can transition to if the LEFTRIGHT model type is used.

The parameter must be greater than zero.

This will clear any trained model.

Parameters
constUINT delta: the delta parameter used for each CHMM
Returns
returns true if the parameter was set correctly, false otherwise

Definition at line 474 of file ContinuousHiddenMarkovModel.cpp.

bool ContinuousHiddenMarkovModel::setModelType ( const UINT  modelType)

This function sets the modelType used for each HMM. This should be one of the HMM modelType enums.

This will clear any trained model.

Parameters
constUINT modelType: the modelType in each HMM
Returns
returns true if the parameter was set correctly, false otherwise

Definition at line 464 of file ContinuousHiddenMarkovModel.cpp.


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