GestureRecognitionToolkit  Version: 0.1.0
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 
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 
118  virtual bool saveModelToFile( std::string filename ) const;
119 
126  virtual bool loadModelFromFile( std::string filename );
127 
134  virtual bool saveModelToFile( std::fstream &file ) const;
135 
143  virtual bool loadModelFromFile( std::fstream &file );
144 
151  virtual bool train_(ClassificationData &trainingData);
152 
159  virtual bool train_(TimeSeriesClassificationData &trainingData);
160 
167  virtual bool train_(ClassificationDataStream &trainingData);
168 
175  virtual bool train_(UnlabelledData &trainingData);
176 
183  virtual bool train_(MatrixFloat &trainingData);
184 
191  UINT quantize(const Float inputValue);
192 
199  UINT quantize(const VectorFloat &inputVector);
200 
206  bool getQuantizerTrained() const;
207 
213  UINT getNumClusters() const;
214 
220  UINT getQuantizedValue() const;
221 
228 
235 
241  bool setNumClusters(const UINT numClusters);
242 
243  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
244  using MLBase::train;
245  using MLBase::train_;
246  using MLBase::predict;
247  using MLBase::predict_;
248 
249 protected:
250  UINT numClusters;
251  SelfOrganizingMap som;
252  VectorFloat quantizationDistances;
253 
255 };
256 
257 GRT_END_NAMESPACE
258 
259 #endif //GRT_SOM_QUANTIZER_HEADER
virtual bool saveModelToFile(std::string filename) const
UINT quantize(const Float inputValue)
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:112
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:114
virtual bool train_(ClassificationData &trainingData)
bool setNumClusters(const UINT numClusters)
VectorFloat getQuantizationDistances() const
virtual bool computeFeatures(const VectorFloat &inputVector)
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:88
bool getQuantizerTrained() const
SOMQuantizer(const UINT numClusters=10)
virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction)
virtual bool clear()
virtual ~SOMQuantizer()
SelfOrganizingMap getSelfOrganizingMap() const
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:90
SOMQuantizer & operator=(const SOMQuantizer &rhs)
virtual bool reset()
virtual bool loadModelFromFile(std::string filename)
UINT getNumClusters() const
UINT getQuantizedValue() const