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.
FiniteStateMachine.h
Go to the documentation of this file.
1 
27 #ifndef GRT_FINITE_STATE_MACHINE_HEADER
28 #define GRT_FINITE_STATE_MACHINE_HEADER
29 
30 #include "../../CoreModules/Classifier.h"
31 #include "FSMParticleFilter.h"
32 #include "../../ClusteringModules/KMeans/KMeans.h"
33 
34 GRT_BEGIN_NAMESPACE
35 
37 {
38 public:
39 
44  FiniteStateMachine(const UINT numParticles = 200,const UINT numClustersPerState = 20,const Float stateTransitionSmoothingCoeff = 0.0,const Float measurementNoise = 10.0);
45 
52 
56  virtual ~FiniteStateMachine(void);
57 
65 
73  virtual bool deepCopyFrom(const Classifier *classifier);
74 
83  virtual bool train_( ClassificationData &trainingData );
84 
93  virtual bool train_( TimeSeriesClassificationData &trainingData );
94 
102  virtual bool train_( TimeSeriesClassificationDataStream &data );
103 
111  virtual bool predict_(VectorFloat &inputVector);
112 
120  virtual bool reset();
121 
128  virtual bool clear();
129 
136  virtual bool print() const;
137 
145  virtual bool saveModelToFile( std::fstream &file ) const;
146 
154  virtual bool loadModelFromFile( std::fstream &file );
155 
156 
157  bool setNumParticles(const UINT numParticles);
158  bool setNumClustersPerState(const UINT numClustersPerState);
159  bool setStateTransitionSmoothingCoeff(const Float stateTransitionSmoothingCoeff);
160  bool setMeasurementNoise(const Float measurementNoise);
161 
162  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
165  using MLBase::train;
166  using MLBase::train_;
167  using MLBase::predict;
168  using MLBase::predict_;
169 
170 protected:
171  bool recomputePT();
172  bool recomputePE();
173  bool initParticles();
174 
175  UINT numParticles;
176  UINT numClustersPerState;
177  Float stateTransitionSmoothingCoeff;
178  Float measurementNoise;
179  FSMParticleFilter particles;
180  MatrixFloat stateTransitions;
181  Vector< MatrixFloat > stateEmissions;
184 
186 };
187 
188 GRT_END_NAMESPACE
189 
190 #endif
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:112
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:114
FiniteStateMachine(const UINT numParticles=200, const UINT numClustersPerState=20, const Float stateTransitionSmoothingCoeff=0.0, const Float measurementNoise=10.0)
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:88
virtual bool print() const
virtual ~FiniteStateMachine(void)
virtual bool saveModelToFile(std::string filename) const
Definition: MLBase.cpp:146
virtual bool deepCopyFrom(const Classifier *classifier)
Vector< Vector< IndexedDouble > > pt
This stores the stateTransitions matrix in a format more efficient for the particle filter...
virtual bool loadModelFromFile(std::string filename)
Definition: MLBase.cpp:168
virtual bool train_(ClassificationData &trainingData)
virtual bool saveModelToFile(std::fstream &file) const
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:90
virtual bool predict_(VectorFloat &inputVector)
Vector< Vector< VectorFloat > > pe
This stores the stateEmissions model in a format more efficient for the particle filter.
virtual bool loadModelFromFile(std::fstream &file)
FiniteStateMachine & operator=(const FiniteStateMachine &rhs)