GestureRecognitionToolkit  Version: 0.2.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 GRT_API 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 save( std::fstream &file ) const;
121 
129  virtual bool load( std::fstream &file );
130 
137  virtual bool recomputeNullRejectionThresholds();
138 
144  UINT getNumMixtureModels();
145 
152  Vector< MixtureModel > getModels();
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
181  using MLBase::save;
182  using MLBase::load;
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
206 
virtual bool recomputeNullRejectionThresholds()
Definition: Classifier.h:237
Definition: GMM.h:49
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:115
bool setMinChange(const Float minChange)
Definition: MLBase.cpp:287
This class implements a MixtureModel, which is a container for holding a class model for the GRT::GMM...
virtual bool save(const std::string filename) const
Definition: MLBase.cpp:143
virtual bool load(const std::string filename)
Definition: MLBase.cpp:167
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: Classifier.h:63
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:91
virtual bool clear()
Definition: Classifier.cpp:142