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.
RBMQuantizer.h
Go to the documentation of this file.
1 
37 #ifndef GRT_RBM_QUANTIZER_HEADER
38 #define GRT_RBM_QUANTIZER_HEADER
39 
40 //Include the main GRT header to get access to the FeatureExtraction base class
41 #include "../../CoreModules/FeatureExtraction.h"
42 #include "../../CoreAlgorithms/BernoulliRBM/BernoulliRBM.h"
43 #include "../../DataStructures/TimeSeriesClassificationData.h"
44 #include "../../DataStructures/ClassificationDataStream.h"
45 #include "../../DataStructures/UnlabelledData.h"
46 
47 GRT_BEGIN_NAMESPACE
48 
49 class GRT_API RBMQuantizer : public FeatureExtraction{
50 public:
56  RBMQuantizer(const UINT numClusters=10);
57 
63  RBMQuantizer(const RBMQuantizer &rhs);
64 
68  virtual ~RBMQuantizer();
69 
76  RBMQuantizer& operator=(const RBMQuantizer &rhs);
77 
86  virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction);
87 
96  virtual bool computeFeatures(const VectorFloat &inputVector);
97 
104  virtual bool reset();
105 
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 train_(ClassificationData &trainingData);
138 
145  virtual bool train_(TimeSeriesClassificationData &trainingData);
146 
153  virtual bool train_(ClassificationDataStream &trainingData);
154 
161  virtual bool train_(UnlabelledData &trainingData);
162 
169  virtual bool train_(MatrixFloat &trainingData);
170 
177  UINT quantize(const Float inputValue);
178 
185  UINT quantize(const VectorFloat &inputVector);
186 
192  bool getQuantizerTrained() const;
193 
199  UINT getNumClusters() const;
200 
206  UINT getQuantizedValue() const;
207 
213  VectorFloat getQuantizationDistances() const;
214 
220  BernoulliRBM getBernoulliRBM() const;
221 
227  bool setNumClusters(const UINT numClusters);
228 
229  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
230  using MLBase::save;
231  using MLBase::load;
232  using MLBase::train;
233  using MLBase::train_;
234  using MLBase::predict;
235  using MLBase::predict_;
236 
242  static std::string getId();
243 
244 protected:
245  UINT numClusters;
246  BernoulliRBM rbm;
247  VectorFloat quantizationDistances;
248 
249 private:
251  static std::string id;
252 };
253 
254 GRT_END_NAMESPACE
255 
256 #endif //GRT_RBM_QUANTIZER_HEADER
257 
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:135
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool reset()
Definition: MLBase.cpp:147
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:107
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool computeFeatures(const VectorFloat &inputVector)
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:109
virtual bool clear() override
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190
virtual bool deepCopyFrom(const FeatureExtraction *rhs)