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.
ANBC.h
Go to the documentation of this file.
1 
26 #ifndef GRT_ANBC_HEADER
27 #define GRT_ANBC_HEADER
28 
29 #include "ANBC_Model.h"
30 #include "../../CoreModules/Classifier.h"
31 
32 GRT_BEGIN_NAMESPACE
33 
34 #define MIN_SCALE_VALUE 1.0e-10
35 #define MAX_SCALE_VALUE 1
36 
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 
196  static std::string getId();
197 
198  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
199  using MLBase::save;
200  using MLBase::load;
201  using MLBase::train_;
202  using MLBase::predict_;
203 
204 protected:
205  bool loadLegacyModelFromFile( std::fstream &file );
206 
207  bool weightsDataSet; //A flag to indicate if the user has manually set the weights buffer
208  ClassificationData weightsData; //The weights of each feature for each class for training the algorithm
209  Vector< ANBC_Model > models; //A buffer to hold all the models
210 
211 private:
212  static RegisterClassifierModule< ANBC > registerModule;
213  static const std::string id;
214 };
215 
216 GRT_END_NAMESPACE
217 
218 #endif // GRT_WEAK_CLASSIFIER_HEADER
219 
std::string getId() const
Definition: GRTBase.cpp:85
virtual bool recomputeNullRejectionThresholds()
Definition: Classifier.h:255
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:137
VectorFloat getNullRejectionThresholds() const
Definition: Classifier.cpp:236
virtual bool setNullRejectionCoeff(const Float nullRejectionCoeff)
Definition: Classifier.cpp:254
bool clearWeights()
Definition: ANBC.h:189
virtual bool save(const std::string &filename) const
Definition: MLBase.cpp:167
Vector< ANBC_Model > getModels()
Definition: ANBC.h:163
This class implements a container for an ANBC model.
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: Classifier.h:64
Definition: ANBC.h:50
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