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.
ParticleClassifier.h
1 /*
2 GRT MIT License
3 Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6 and associated documentation files (the "Software"), to deal in the Software without restriction,
7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all copies or substantial
12 portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 */
20 
21 #ifndef GRT_PARTICLE_CLASSIFIER_HEADER
22 #define GRT_PARTICLE_CLASSIFIER_HEADER
23 
24 #include "../../CoreModules/Classifier.h"
25 #include "ParticleClassifierParticleFilter.h"
26 
27 GRT_BEGIN_NAMESPACE
28 
29 class GRT_API ParticleClassifier : public Classifier
30 {
31 public:
32 
36  ParticleClassifier(const unsigned int numParticles = 2000,const Float sensorNoise = 20.0,const Float transitionSigma = 0.005,const Float phaseSigma = 0.1,const Float velocitySigma = 0.01);
37 
46 
50  virtual ~ParticleClassifier(void);
51 
58  ParticleClassifier& operator=(const ParticleClassifier &rhs);
59 
67  virtual bool deepCopyFrom(const Classifier *classifier);
68 
76  virtual bool train_(TimeSeriesClassificationData &trainingData);
77 
85  virtual bool predict_(VectorFloat &inputVector);
86 
94  virtual bool save( std::fstream &file ) const;
95 
103  virtual bool load( std::fstream &file );
104 
110  virtual bool clear();
111 
117  virtual bool reset();
118 
124  static std::string getId();
125 
126  const Vector< ParticleClassifierGestureTemplate >& getGestureTemplates() const;
127 
128  const ParticleClassifierParticleFilter& getParticleFilter() const;
129 
130  VectorFloat getStateEstimation() const;
131 
132  Float getPhase() const;
133 
134  Float getVelocity() const;
135 
136  bool setNumParticles(const unsigned int numParticles);
137 
138  bool setSensorNoise(const unsigned int sensorNoise);
139 
140  bool setTransitionSigma(const unsigned int transitionSigma);
141 
142  bool setPhaseSigma(const unsigned int phaseSigma);
143 
144  bool setVelocitySigma(const unsigned int velocitySigma);
145 
146  using MLBase::predict_;
147  using MLBase::train_;
148 
149 protected:
150  unsigned int numParticles;
151  Float sensorNoise;
152  Float transitionSigma;
153  Float phaseSigma;
154  Float velocitySigma;
155  ParticleClassifierParticleFilter particleFilter;
156 
157 private:
158  static const std::string id;
160 
161 };
162 
163 GRT_END_NAMESPACE
164 
165 #endif
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: Classifier.h:64
Float getPhase() const
Definition: Classifier.cpp:196
virtual bool reset()
Definition: Classifier.cpp:132
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