GestureRecognitionToolkit  Version: 0.2.5
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 
26 #ifndef GRT_GMM_HEADER
27 #define GRT_GMM_HEADER
28 
29 #include "../../CoreModules/Classifier.h"
30 #include "../../ClusteringModules/GaussianMixtureModels/GaussianMixtureModels.h"
31 #include "MixtureModel.h"
32 
33 #define GMM_MIN_SCALE_VALUE 0.0001
34 #define GMM_MAX_SCALE_VALUE 1.0
35 
36 GRT_BEGIN_NAMESPACE
37 
48 class GRT_API GMM : public Classifier
49 {
50 public:
54  GMM(UINT numMixtureModels = 2,bool useScaling=false,bool useNullRejection=false,Float nullRejectionCoeff=1.0,UINT maxIter=100,Float minChange=1.0e-5);
55 
61  GMM(const GMM &rhs);
62 
66  virtual ~GMM(void);
67 
74  GMM &operator=(const GMM &rhs);
75 
83  virtual bool deepCopyFrom(const Classifier *classifier);
84 
93  virtual bool train_(ClassificationData &trainingData);
94 
102  virtual bool predict_(VectorFloat &inputVector);
103 
110  virtual bool clear();
111 
119  virtual bool save( std::fstream &file ) const;
120 
128  virtual bool load( std::fstream &file );
129 
136  virtual bool recomputeNullRejectionThresholds();
137 
143  UINT getNumMixtureModels();
144 
151  Vector< MixtureModel > getModels();
152 
160  bool setNumMixtureModels(const UINT K);
161 
170  GRT_DEPRECATED_MSG( "Use the base class function, setMaxNumEpochs(const UINT maxNumEpochs) instead", bool setMaxIter(UINT maxIter) );
171 
177  static std::string getId();
178 
179  //Tell the compiler we are using the base class train method to stop hidden virtual function warnings
180  using MLBase::save;
181  using MLBase::load;
182  using MLBase::train_;
183  using MLBase::predict_;
184 
185 protected:
186  Float computeMixtureLikelihood(const VectorFloat &x,UINT k);
187  bool loadLegacyModelFromFile( std::fstream &file );
188 
189  UINT numMixtureModels;
190  Vector< MixtureModel > models;
191 
192 private:
193  static RegisterClassifierModule< GMM > registerModule;
194  static const std::string id;
195 };
196 
197 GRT_END_NAMESPACE
198 
199 #endif //GRT_GMM_HEADER
200 
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool recomputeNullRejectionThresholds()
Definition: Classifier.h:255
Definition: GMM.h:48
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
This class implements a MixtureModel, which is a container for holding a class model for the GRT::GMM...
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: Classifier.h:64
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:109
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190
virtual bool clear()
Definition: Classifier.cpp:151
This is the main base class that all GRT Classification algorithms should inherit from...
Definition: Classifier.h:41