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.
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 
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 
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 saveModelToFile( std::fstream &file ) const;
95 
103  virtual bool loadModelFromFile( std::fstream &file );
104 
110  virtual bool clear();
111 
117  virtual bool reset();
118 
119  const Vector< ParticleClassifierGestureTemplate >& getGestureTemplates() const;
120 
121  const ParticleClassifierParticleFilter& getParticleFilter() const;
122 
123  VectorFloat getStateEstimation() const;
124 
125  Float getPhase() const;
126 
127  Float getVelocity() const;
128 
129  bool setNumParticles(const unsigned int numParticles);
130 
131  bool setSensorNoise(const unsigned int sensorNoise);
132 
133  bool setTransitionSigma(const unsigned int transitionSigma);
134 
135  bool setPhaseSigma(const unsigned int phaseSigma);
136 
137  bool setVelocitySigma(const unsigned int velocitySigma);
138 
139  using MLBase::predict;
140  using MLBase::train;
141 
142 protected:
143  unsigned int numParticles;
144  Float sensorNoise;
145  Float transitionSigma;
146  Float phaseSigma;
147  Float velocitySigma;
148  ParticleClassifierParticleFilter particleFilter;
149 
150 private:
152 
153 };
154 
155 GRT_END_NAMESPACE
156 
157 #endif
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:112
virtual ~ParticleClassifier(void)
virtual bool saveModelToFile(std::fstream &file) const
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:88
ParticleClassifier & operator=(const ParticleClassifier &rhs)
virtual bool loadModelFromFile(std::fstream &file)
virtual bool predict_(VectorFloat &inputVector)
virtual bool train_(TimeSeriesClassificationData &trainingData)
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)
virtual bool deepCopyFrom(const Classifier *classifier)