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.
DecisionStump.h
Go to the documentation of this file.
1 
29 #ifndef GRT_DECISION_STUMP_HEADER
30 #define GRT_DECISION_STUMP_HEADER
31 
32 #include "WeakClassifier.h"
33 
34 GRT_BEGIN_NAMESPACE
35 
36 class GRT_API DecisionStump : public WeakClassifier{
37 public:
45  DecisionStump(const UINT numRandomSplits = 100);
46 
50  virtual ~DecisionStump();
51 
55  DecisionStump(const DecisionStump &rhs);
56 
61 
68  virtual bool deepCopyFrom(const WeakClassifier *weakClassifer);
69 
77  virtual bool train(ClassificationData &trainingData, VectorFloat &weights);
78 
86  virtual Float predict(const VectorFloat &x);
87 
94  virtual bool saveModelToFile( std::fstream &file ) const;
95 
102  virtual bool loadModelFromFile( std::fstream &file );
103 
107  virtual void print() const;
108 
112  UINT getDecisionFeatureIndex() const;
113 
117  UINT getDirection() const;
118 
122  UINT getNumRandomSplits() const;
123 
127  Float getDecisionValue() const;
128 
129 protected:
131  UINT direction;
134 
136 };
137 
138 GRT_END_NAMESPACE
139 
140 #endif //GRT_DECISION_STUMP_HEADER
static RegisterWeakClassifierModule< DecisionStump > registerModule
This is used to register the DecisionStump with the WeakClassifier base class.
virtual Float predict(const VectorFloat &x)
UINT direction
Indicates if the decision spilt threshold is greater than (1), or less than (0)
virtual bool deepCopyFrom(const WeakClassifier *weakClassifer)
Float decisionValue
The decision spilt threshold.
virtual bool saveModelToFile(std::fstream &file) const
virtual bool train(ClassificationData &trainingData, VectorFloat &weights)
This is the main base class for all GRT WeakClassifiers.
virtual bool loadModelFromFile(std::fstream &file)
WeakClassifier & operator=(const WeakClassifier &rhs)
UINT numRandomSplits
The number of random splits used to search for the best decision spilt.
UINT decisionFeatureIndex
The dimension that the data will be spilt on.
virtual void print() const