GestureRecognitionToolkit  Version: 0.2.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
ANBC.h
Go to the documentation of this file.
1 
39 #ifndef GRT_ANBC_HEADER
40 #define GRT_ANBC_HEADER
41 
42 #include "ANBC_Model.h"
43 #include "../../CoreModules/Classifier.h"
44 
45 GRT_BEGIN_NAMESPACE
46 
47 #define MIN_SCALE_VALUE 1.0e-10
48 #define MAX_SCALE_VALUE 1
49 
50 class GRT_API ANBC : public Classifier
51 {
52  public:
60  ANBC(bool useScaling=false,bool useNullRejection=false,double nullRejectionCoeff=10.0);
61 
67  ANBC(const ANBC &rhs);
68 
72  virtual ~ANBC(void);
73 
80  ANBC &operator=(const ANBC &rhs);
81 
89  virtual bool deepCopyFrom(const Classifier *classifier);
90 
98  virtual bool train_(ClassificationData &trainingData);
99 
107  virtual bool predict_(VectorFloat &inputVector);
108 
114  virtual bool reset();
115 
122  virtual bool clear();
123 
131  virtual bool save( std::fstream &file ) const;
132 
140  virtual bool load( std::fstream &file );
141 
149  virtual bool recomputeNullRejectionThresholds();
150 
157 
163  Vector< ANBC_Model > getModels(){ return models; }
164 
165  //Setters
173  bool setNullRejectionCoeff(double nullRejectionCoeff);
174 
182  bool setWeights(const ClassificationData &weightsData);
183 
189  bool clearWeights(){ weightsDataSet = false; weightsData.clear(); return true; }
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  bool weightsDataSet; //A flag to indicate if the user has manually set the weights buffer
201  ClassificationData weightsData; //The weights of each feature for each class for training the algorithm
202  Vector< ANBC_Model > models; //A buffer to hold all the models
203 
204  static RegisterClassifierModule< ANBC > registerModule;
205 };
206 
207 GRT_END_NAMESPACE
208 
209 #endif // GRT_WEAK_CLASSIFIER_HEADER
210 
virtual bool recomputeNullRejectionThresholds()
Definition: Classifier.h:237
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:115
VectorFloat getNullRejectionThresholds() const
Definition: Classifier.cpp:218
bool clearWeights()
Definition: ANBC.h:189
Vector< ANBC_Model > getModels()
Definition: ANBC.h:163
virtual bool save(const std::string filename) const
Definition: MLBase.cpp:143
This class implements a container for an ANBC model.
virtual bool load(const std::string filename)
Definition: MLBase.cpp:167
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: Classifier.h:63
Definition: ANBC.h:50
virtual bool setNullRejectionCoeff(Float nullRejectionCoeff)
Definition: Classifier.cpp:236
virtual bool reset()
Definition: Classifier.cpp:123
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:91
virtual bool clear()
Definition: Classifier.cpp:142