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.
MinDist.h
Go to the documentation of this file.
1 
26 #ifndef GRT_MINDIST_HEADER
27 #define GRT_MINDIST_HEADER
28 
29 #include "MinDistModel.h"
30 #include "../../CoreModules/Classifier.h"
31 
32 GRT_BEGIN_NAMESPACE
33 
41 class GRT_API MinDist : public Classifier
42 {
43 public:
52  MinDist(bool useScaling=false,bool useNullRejection=false,Float nullRejectionCoeff=10.0,UINT numClusters=10);
53 
59  MinDist(const MinDist &rhs);
60 
64  virtual ~MinDist(void);
65 
72  MinDist &operator=(const MinDist &rhs);
73 
81  virtual bool deepCopyFrom(const Classifier *classifier);
82 
90  virtual bool train_(ClassificationData &trainingData);
91 
99  virtual bool predict_(VectorFloat &inputVector);
100 
107  virtual bool clear();
108 
116  virtual bool save( std::fstream &file ) const;
117 
125  virtual bool load( std::fstream &file );
126 
134  virtual bool recomputeNullRejectionThresholds();
135 
141  UINT getNumClusters() const;
142 
148  Vector< MinDistModel > getModels() const;
149 
157  virtual bool setNullRejectionCoeff(Float nullRejectionCoeff);
158 
166  bool setNumClusters(UINT numClusters);
167 
173  static std::string getId();
174 
175  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
176  using MLBase::save;
177  using MLBase::load;
178  using MLBase::train_;
179  using MLBase::predict_;
180 
181 protected:
182  bool loadLegacyModelFromFile( std::fstream &file );
183 
184  UINT numClusters;
185  Vector< MinDistModel > models; //A buffer to hold all the models
186 
187 private:
188  static const std::string id;
189  static RegisterClassifierModule< MinDist > registerModule;
190 };
191 
192 } //End of namespace GRT
193 
194 #endif //GRT_MINDIST_HEADER
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool recomputeNullRejectionThresholds()
Definition: Classifier.h:255
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool setNullRejectionCoeff(const Float nullRejectionCoeff)
Definition: Classifier.cpp:254
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: Classifier.h:64
This class implements the MinDist classifier algorithm.
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