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.
SOMQuantizer.h
Go to the documentation of this file.
1 
37 #ifndef GRT_SOM_QUANTIZER_HEADER
38 #define GRT_SOM_QUANTIZER_HEADER
39 
40 //Include the main GRT header to get access to the FeatureExtraction base class
41 #include "../../CoreModules/FeatureExtraction.h"
42 #include "../../ClusteringModules/SelfOrganizingMap/SelfOrganizingMap.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 SOMQuantizer : public FeatureExtraction{
50 public:
56  SOMQuantizer(const UINT numClusters=10);
57 
63  SOMQuantizer(const SOMQuantizer &rhs);
64 
68  virtual ~SOMQuantizer();
69 
76  SOMQuantizer& operator=(const SOMQuantizer &rhs);
77 
86  virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction);
87 
95  virtual bool computeFeatures(const VectorFloat &inputVector);
96 
103  virtual bool reset();
104 
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 train_(ClassificationData &trainingData);
137 
144  virtual bool train_(TimeSeriesClassificationData &trainingData);
145 
152  virtual bool train_(ClassificationDataStream &trainingData);
153 
160  virtual bool train_(UnlabelledData &trainingData);
161 
168  virtual bool train_(MatrixFloat &trainingData);
169 
176  UINT quantize(const Float inputValue);
177 
184  UINT quantize(const VectorFloat &inputVector);
185 
191  bool getQuantizerTrained() const;
192 
198  UINT getNumClusters() const;
199 
205  UINT getQuantizedValue() const;
206 
212  VectorFloat getQuantizationDistances() const;
213 
219  SelfOrganizingMap getSelfOrganizingMap() const;
220 
226  bool setNumClusters(const UINT numClusters);
227 
228  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
229  using MLBase::save;
230  using MLBase::load;
231  using MLBase::train;
232  using MLBase::train_;
233  using MLBase::predict;
234  using MLBase::predict_;
235 
241  static std::string getId();
242 
243 protected:
244  UINT numClusters;
245  SelfOrganizingMap som;
246  VectorFloat quantizationDistances;
247 
248 private:
250  static std::string id;
251 };
252 
253 GRT_END_NAMESPACE
254 
255 #endif //GRT_SOM_QUANTIZER_HEADER
256 
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)