GestureRecognitionToolkit
Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
DiscreteHiddenMarkovModel.h
Go to the documentation of this file.
1
31
#ifndef GRT_DISCRETE_HIDDEN_MARKOV_MODEL_HEADER
32
#define GRT_DISCRETE_HIDDEN_MARKOV_MODEL_HEADER
33
34
#include "
HMMEnums.h
"
35
#include "../../Util/GRTCommon.h"
36
#include "../../CoreModules/MLBase.h"
37
38
GRT_BEGIN_NAMESPACE
39
40
//This class is used for the HMM batch training
41
class
HMMTrainingObject
{
42
public
:
43
HMMTrainingObject
(){
44
pk = 0.0;
45
}
46
~
HMMTrainingObject
(){}
47
MatrixFloat
alpha;
//The forward estimate matrix
48
MatrixFloat
beta;
//The backward estimate matrix
49
VectorFloat
c;
//The scaling coefficient Vector
50
Float pk;
//P( O | Model )
51
};
52
53
class
DiscreteHiddenMarkovModel
:
public
MLBase
{
54
55
public
:
56
DiscreteHiddenMarkovModel
();
57
58
DiscreteHiddenMarkovModel
(
const
UINT numStates,
const
UINT numSymbols,
const
UINT modelType,
const
UINT delta);
59
60
DiscreteHiddenMarkovModel
(
const
MatrixFloat
&a,
const
MatrixFloat
&b,
const
VectorFloat
&pi,
const
UINT modelType,
const
UINT delta);
61
62
DiscreteHiddenMarkovModel
(
const
DiscreteHiddenMarkovModel
&rhs);
63
64
virtual
~
DiscreteHiddenMarkovModel
();
65
66
Float predict(
const
UINT newSample);
67
Float predict(
const
Vector<UINT>
&obs);
68
69
bool
resetModel(
const
UINT numStates,
const
UINT numSymbols,
const
UINT modelType,
const
UINT delta);
70
bool
train(
const
Vector
<
Vector<UINT>
> &trainingData);
71
72
virtual
bool
reset
();
73
80
virtual
bool
saveModelToFile
( std::fstream &file )
const
;
81
88
virtual
bool
loadModelFromFile
( std::fstream &file );
89
90
bool
randomizeMatrices(
const
UINT numStates,
const
UINT numSymbols);
91
Float predictLogLikelihood(
const
Vector<UINT>
&obs);
92
bool
forwardBackward(
HMMTrainingObject
&trainingObject,
const
Vector<UINT>
&obs);
93
bool
train_(
const
Vector
<
Vector<UINT>
> &obs,
const
UINT maxIter, UINT ¤tIter,Float &newLoglikelihood);
94
virtual
bool
print
()
const
;
95
96
VectorFloat
getTrainingIterationLog()
const
;
97
98
UINT numStates;
//The number of states for this model
99
UINT numSymbols;
//The number of symbols for this model
100
MatrixFloat
a;
//The transitions probability matrix
101
MatrixFloat
b;
//The emissions probability matrix
102
VectorFloat
pi;
//The state start probability Vector
103
VectorFloat
trainingIterationLog;
//Stores the loglikelihood at each iteration the BaumWelch algorithm
104
105
UINT modelType;
106
UINT delta;
//The number of states a model can move to in a LeftRight model
107
UINT numRandomTrainingIterations;
//The number of training loops to find the best starting values
108
Float logLikelihood;
//The log likelihood of an observation sequence given the modal, calculated by the forward method
109
Float cThreshold;
//The classification threshold for this model
110
CircularBuffer<UINT>
observationSequence;
111
Vector< UINT >
estimatedStates;
112
};
113
114
GRT_END_NAMESPACE
115
116
#endif //GRT_HIDDEN_MARKOV_MODEL_HEADER
DiscreteHiddenMarkovModel::saveModelToFile
virtual bool saveModelToFile(std::fstream &file) const
Definition:
DiscreteHiddenMarkovModel.cpp:672
MatrixFloat
Definition:
MatrixFloat.h:36
HMMEnums.h
This class acts as the main interface for using a Hidden Markov Model.
DiscreteHiddenMarkovModel::reset
virtual bool reset()
Definition:
DiscreteHiddenMarkovModel.cpp:663
CircularBuffer< UINT >
DiscreteHiddenMarkovModel::loadModelFromFile
virtual bool loadModelFromFile(std::fstream &file)
Definition:
DiscreteHiddenMarkovModel.cpp:722
VectorFloat
Definition:
VectorFloat.h:33
DiscreteHiddenMarkovModel::print
virtual bool print() const
Definition:
DiscreteHiddenMarkovModel.cpp:835
HMMTrainingObject
Definition:
DiscreteHiddenMarkovModel.h:41
Vector< UINT >
DiscreteHiddenMarkovModel
Definition:
DiscreteHiddenMarkovModel.h:53
MLBase
Definition:
MLBase.h:70
GRT
ClassificationModules
HMM
DiscreteHiddenMarkovModel.h
Generated on Sun Feb 21 2016 20:06:25 for GestureRecognitionToolkit by
1.8.11