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.
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 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 saveModelToFile( std::fstream &file ) const;
132 
140  virtual bool loadModelFromFile( 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
194  using MLBase::train;
195  using MLBase::train_;
196  using MLBase::predict;
197  using MLBase::predict_;
198 
199 protected:
200  bool loadLegacyModelFromFile( std::fstream &file );
201 
202  bool weightsDataSet; //A flag to indicate if the user has manually set the weights buffer
203  ClassificationData weightsData; //The weights of each feature for each class for training the algorithm
204  Vector< ANBC_Model > models; //A buffer to hold all the models
205 
206  static RegisterClassifierModule< ANBC > registerModule;
207 };
208 
209 GRT_END_NAMESPACE
210 
211 #endif // GRT_WEAK_CLASSIFIER_HEADER
virtual bool predict(VectorFloat inputVector)
Definition: MLBase.cpp:112
virtual bool reset()
Definition: ANBC.cpp:284
bool loadLegacyModelFromFile(std::fstream &file)
Definition: ANBC.cpp:536
virtual bool predict_(VectorFloat &inputVector)
Definition: MLBase.cpp:114
virtual ~ANBC(void)
Definition: ANBC.cpp:55
virtual bool deepCopyFrom(const Classifier *classifier)
Definition: ANBC.cpp:72
bool setWeights(const ClassificationData &weightsData)
Definition: ANBC.cpp:526
bool clearWeights()
Definition: ANBC.h:189
virtual bool train(ClassificationData trainingData)
Definition: MLBase.cpp:88
virtual bool loadModelFromFile(std::fstream &file)
Definition: ANBC.cpp:349
ANBC(bool useScaling=false, bool useNullRejection=false, double nullRejectionCoeff=10.0)
virtual bool recomputeNullRejectionThresholds()
Definition: ANBC.cpp:270
VectorFloat getNullRejectionThresholds() const
Definition: ANBC.cpp:511
Vector< ANBC_Model > getModels()
Definition: ANBC.h:163
This class implements a container for an ANBC model.
virtual bool train_(ClassificationData &trainingData)
Definition: ANBC.cpp:90
ANBC & operator=(const ANBC &rhs)
Definition: ANBC.cpp:59
virtual bool clear()
Definition: ANBC.cpp:288
virtual bool saveModelToFile(std::string filename) const
Definition: MLBase.cpp:146
Definition: ANBC.h:50
virtual bool predict_(VectorFloat &inputVector)
Definition: ANBC.cpp:199
virtual bool loadModelFromFile(std::string filename)
Definition: MLBase.cpp:168
virtual bool saveModelToFile(std::fstream &file) const
Definition: ANBC.cpp:300
virtual bool train_(ClassificationData &trainingData)
Definition: MLBase.cpp:90
bool setNullRejectionCoeff(double nullRejectionCoeff)
Definition: ANBC.cpp:516