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.
AdaBoost.h
Go to the documentation of this file.
1 
26 #ifndef GRT_ADABOOST_HEADER
27 #define GRT_ADABOOST_HEADER
28 
29 #include "../../CoreModules/Classifier.h"
30 #include "AdaBoostClassModel.h"
33 
34 GRT_BEGIN_NAMESPACE
35 
55 class GRT_API AdaBoost : public Classifier
56 {
57 public:
58  enum PredictionMethods{MAX_POSITIVE_VALUE=0,MAX_VALUE};
59 
70  AdaBoost(const WeakClassifier &weakClassifier = DecisionStump(),bool useScaling=false,bool useNullRejection=false,Float nullRejectionCoeff=10.0,UINT numBoostingIterations=20,UINT predictionMethod=MAX_VALUE);
71 
77  AdaBoost(const AdaBoost &rhs);
78 
82  virtual ~AdaBoost();
83 
90  AdaBoost &operator=(const AdaBoost &rhs);
91 
99  virtual bool deepCopyFrom(const Classifier *classifier);
100 
108  virtual bool train_(ClassificationData &trainingData);
109 
117  virtual bool predict_(VectorFloat &inputVector);
118 
125  virtual bool clear();
126 
134  virtual bool save( std::fstream &file ) const;
135 
143  virtual bool load( std::fstream &file );
144 
152  virtual bool recomputeNullRejectionThresholds();
153 
161  bool setNullRejectionCoeff(Float nullRejectionCoeff);
162 
170  bool setWeakClassifier(const WeakClassifier &weakClassifer);
171 
179  bool addWeakClassifier(const WeakClassifier &weakClassifer);
180 
186  bool clearWeakClassifiers();
187 
194  bool setNumBoostingIterations(UINT numBoostingIterations);
195 
202  bool setPredictionMethod(UINT predictionMethod);
203 
209  void printModel();
210 
216  Vector< AdaBoostClassModel > getModels() const { return models; }
217 
223  static std::string getId();
224 
225  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
226  using MLBase::save;
227  using MLBase::load;
228  using MLBase::train;
229  using MLBase::train_;
230  using MLBase::predict;
231  using MLBase::predict_;
232 
233 protected:
234  bool loadLegacyModelFromFile( std::fstream &file );
235 
236  UINT numBoostingIterations;
237  UINT predictionMethod;
238  Vector< WeakClassifier* > weakClassifiers;
240 
241 private:
242  static RegisterClassifierModule< AdaBoost > registerModule;
243  static const std::string id;
244 };
245 
246 GRT_END_NAMESPACE
247 
248 #endif //GRT_ADABOOST_HEADER
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:135
virtual bool recomputeNullRejectionThresholds()
Definition: Classifier.h:255
This file implements a container for an AdaBoost class model.
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
virtual bool setNullRejectionCoeff(const Float nullRejectionCoeff)
Definition: Classifier.cpp:254
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:107
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: Classifier.h:64
Vector< AdaBoostClassModel > getModels() const
Definition: AdaBoost.h:216
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:109
This class implements a Radial Basis Function Weak Classifier. The Radial Basis Function (RBF) class ...
virtual bool load(const std::string &filename)
Definition: MLBase.cpp:190
virtual bool clear()
Definition: Classifier.cpp:151
This class implements a DecisionStump, which is a single node of a DecisionTree.
This is the main base class that all GRT Classification algorithms should inherit from...
Definition: Classifier.h:41