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.
GMM.h
Go to the documentation of this file.
1 
37 #ifndef GRT_GMM_HEADER
38 #define GRT_GMM_HEADER
39 
40 #include "../../CoreModules/Classifier.h"
41 #include "../../ClusteringModules/GaussianMixtureModels/GaussianMixtureModels.h"
42 #include "MixtureModel.h"
43 
44 #define GMM_MIN_SCALE_VALUE 0.0001
45 #define GMM_MAX_SCALE_VALUE 1.0
46 
47 GRT_BEGIN_NAMESPACE
48 
49 class GMM : public Classifier
50 {
51 public:
55  GMM(UINT numMixtureModels = 2,bool useScaling=false,bool useNullRejection=false,Float nullRejectionCoeff=1.0,UINT maxIter=100,Float minChange=1.0e-5);
56 
62  GMM(const GMM &rhs);
63 
67  virtual ~GMM(void);
68 
75  GMM &operator=(const GMM &rhs);
76 
84  virtual bool deepCopyFrom(const Classifier *classifier);
85 
94  virtual bool train_(ClassificationData &trainingData);
95 
103  virtual bool predict_(VectorFloat &inputVector);
104 
111  virtual bool clear();
112 
120  virtual bool saveModelToFile( std::fstream &file ) const;
121 
129  virtual bool loadModelFromFile( std::fstream &file );
130 
137  virtual bool recomputeNullRejectionThresholds();
138 
144  UINT getNumMixtureModels();
145 
153 
161  bool setNumMixtureModels(UINT K);
162 
169  bool setMinChange(Float minChange);
170 
178  bool setMaxIter(UINT maxIter);
179 
180  //Tell the compiler we are using the base class train method to stop hidden virtual function warnings
183  using MLBase::train;
184  using MLBase::predict;
185 
186 protected:
187  Float computeMixtureLikelihood(const VectorFloat &x,UINT k);
188  bool loadLegacyModelFromFile( std::fstream &file );
189 
190  UINT numMixtureModels;
191  UINT maxIter;
192  Float minChange;
193  Vector< MixtureModel > models;
194 
195  DebugLog debugLog;
196  ErrorLog errorLog;
197  WarningLog warningLog;
198 
199  static RegisterClassifierModule< GMM > registerModule;
200 
201 };
202 
203 GRT_END_NAMESPACE
204 
205 #endif //GRT_GMM_HEADER
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:112
virtual bool train_(ClassificationData &trainingData)
Definition: GMM.cpp:161
Definition: GMM.h:49
virtual bool loadModelFromFile(std::fstream &file)
Definition: GMM.cpp:349
virtual bool clear()
Definition: GMM.cpp:534
virtual bool recomputeNullRejectionThresholds()
Definition: GMM.cpp:545
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:88
Vector< MixtureModel > getModels()
Definition: GMM.cpp:561
bool setNumMixtureModels(UINT K)
Definition: GMM.cpp:566
This class implements a MixtureModel, which is a container for holding a class model for the GRT::GMM...
virtual bool saveModelToFile(std::fstream &file) const
Definition: GMM.cpp:281
virtual bool predict_(VectorFloat &inputVector)
Definition: GMM.cpp:97
GMM(UINT numMixtureModels=2, bool useScaling=false, bool useNullRejection=false, Float nullRejectionCoeff=1.0, UINT maxIter=100, Float minChange=1.0e-5)
Definition: GMM.cpp:28
virtual bool saveModelToFile(std::string filename) const
Definition: MLBase.cpp:146
UINT getNumMixtureModels()
Definition: GMM.cpp:557
virtual bool loadModelFromFile(std::string filename)
Definition: MLBase.cpp:168
GMM & operator=(const GMM &rhs)
Definition: GMM.cpp:56
virtual ~GMM(void)
Definition: GMM.cpp:54
bool loadLegacyModelFromFile(std::fstream &file)
Definition: GMM.cpp:588
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: GMM.cpp:74
bool setMinChange(Float minChange)
Definition: GMM.cpp:573
bool setMaxIter(UINT maxIter)
Definition: GMM.cpp:580