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.
AdaBoost.h
Go to the documentation of this file.
1 
45 #ifndef GRT_ADABOOST_HEADER
46 #define GRT_ADABOOST_HEADER
47 
48 #include "../../CoreModules/Classifier.h"
49 #include "AdaBoostClassModel.h"
52 
53 GRT_BEGIN_NAMESPACE
54 
55 //typedef DecisionStump AdaBoostWeakClassifier;
56 
57 class AdaBoost : public Classifier
58 {
59 public:
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 saveModelToFile( std::fstream &file ) const;
135 
143  virtual bool loadModelFromFile( 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 
218  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
221  using MLBase::train;
222  using MLBase::train_;
223  using MLBase::predict;
224  using MLBase::predict_;
225 
226 protected:
227  bool loadLegacyModelFromFile( std::fstream &file );
228 
229  UINT numBoostingIterations;
230  UINT predictionMethod;
231  Vector< WeakClassifier* > weakClassifiers;
233 
234  static RegisterClassifierModule< AdaBoost > registerModule;
235 
236 public:
240  enum PredictionMethods{MAX_POSITIVE_VALUE=0,MAX_VALUE};
241 };
242 
243 GRT_END_NAMESPACE
244 
245 #endif //GRT_ADABOOST_HEADER
bool setPredictionMethod(UINT predictionMethod)
Definition: AdaBoost.cpp:552
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:112
PredictionMethods
Definition: AdaBoost.h:240
This file implements a container for an AdaBoost class model.
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:114
AdaBoost(const WeakClassifier &weakClassifier=DecisionStump(), bool useScaling=false, bool useNullRejection=false, Float nullRejectionCoeff=10.0, UINT numBoostingIterations=20, UINT predictionMethod=MAX_VALUE)
Definition: AdaBoost.cpp:28
void printModel()
Definition: AdaBoost.cpp:560
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:88
virtual bool train_(ClassificationData &trainingData)
Definition: AdaBoost.cpp:114
virtual bool loadModelFromFile(std::fstream &file)
Definition: AdaBoost.cpp:434
bool setNumBoostingIterations(UINT numBoostingIterations)
Definition: AdaBoost.cpp:544
virtual bool saveModelToFile(std::fstream &file) const
Definition: AdaBoost.cpp:399
bool addWeakClassifier(const WeakClassifier &weakClassifer)
Definition: AdaBoost.cpp:524
virtual bool recomputeNullRejectionThresholds()
Definition: AdaBoost.cpp:380
virtual bool saveModelToFile(std::string filename) const
Definition: MLBase.cpp:146
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: AdaBoost.cpp:83
virtual ~AdaBoost()
Definition: AdaBoost.cpp:55
virtual bool predict_(VectorFloat &inputVector)
Definition: AdaBoost.cpp:291
bool clearWeakClassifiers()
Definition: AdaBoost.cpp:532
virtual bool loadModelFromFile(std::string filename)
Definition: MLBase.cpp:168
Vector< AdaBoostClassModel > getModels() const
Definition: AdaBoost.h:216
virtual bool clear()
Definition: AdaBoost.cpp:501
bool setWeakClassifier(const WeakClassifier &weakClassifer)
Definition: AdaBoost.cpp:512
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:90
AdaBoost & operator=(const AdaBoost &rhs)
Definition: AdaBoost.cpp:61
bool setNullRejectionCoeff(Float nullRejectionCoeff)
Definition: AdaBoost.cpp:389
This class implements a Radial Basis Function Weak Classifier. The Radial Basis Function (RBF) class ...
This class implements a DecisionStump, which is a single node of a DecisionTree.