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.
BAG.h
Go to the documentation of this file.
1 
26 #ifndef GRT_BAG_HEADER
27 #define GRT_BAG_HEADER
28 
29 #include "../../CoreModules/Classifier.h"
30 
31 GRT_BEGIN_NAMESPACE
32 
44 class GRT_API BAG : public Classifier
45 {
46 public:
52  BAG(bool useScaling=false);
53 
59  BAG(const BAG &rhs);
60 
64  virtual ~BAG(void);
65 
72  BAG &operator=(const BAG &rhs);
73 
81  virtual bool deepCopyFrom(const Classifier *classifier);
82 
90  virtual bool train_(ClassificationData &trainingData);
91 
99  virtual bool predict_(VectorFloat &inputVector);
100 
106  virtual bool reset();
107 
114  virtual bool clear();
115 
123  virtual bool save( std::fstream &file ) const;
124 
132  virtual bool load( std::fstream &file );
133 
139  UINT getEnsembleSize() const;
140 
146  VectorFloat getEnsembleWeights() const;
147 
153  const Vector< Classifier* > getEnsemble() const;
154 
163  bool addClassifierToEnsemble(const Classifier &classifier,Float weight=1);
164 
170  bool clearEnsemble();
171 
182  bool setWeights(const VectorFloat &weights);
183 
189  static std::string getId();
190 
191  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
192  using MLBase::save;
193  using MLBase::load;
194  using MLBase::train_;
195  using MLBase::predict_;
196 
197 protected:
198  bool loadLegacyModelFromFile( std::fstream &file );
199 
200  VectorFloat weights;
201  Vector< Classifier* > ensemble;
202 
203 private:
204  static RegisterClassifierModule< BAG > registerModule;
205  static const std::string id;
206 };
207 
208 GRT_END_NAMESPACE
209 
210 #endif //GRT_BAG_HEADER
211 
Definition: BAG.h:44
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
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