GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
RandomForests.h
Go to the documentation of this file.
1 
36 #ifndef GRT_RANDOM_FORESTS_HEADER
37 #define GRT_RANDOM_FORESTS_HEADER
38 
39 #include "../DecisionTree/DecisionTree.h"
40 
41 namespace GRT{
42 
43 class RandomForests : public Classifier
44 {
45 public:
57  RandomForests(const DecisionTreeNode &decisionTreeNode = DecisionTreeClusterNode(),const UINT forestSize=10,const UINT numRandomSplits=100,const UINT minNumSamplesPerNode=5,const UINT maxDepth=10,const UINT trainingMode = DecisionTree::BEST_RANDOM_SPLIT,const bool removeFeaturesAtEachSpilt = true,const bool useScaling=false);
58 
64  RandomForests(const RandomForests &rhs);
65 
69  virtual ~RandomForests(void);
70 
78 
86  virtual bool deepCopyFrom(const Classifier *classifier);
87 
95  virtual bool train_(ClassificationData &trainingData);
96 
104  virtual bool predict_(VectorDouble &inputVector);
105 
111  virtual bool clear();
112 
118  virtual bool print() const;
119 
127  virtual bool saveModelToFile(fstream &file) const;
128 
136  virtual bool loadModelFromFile(fstream &file);
137 
143  UINT getForestSize() const;
144 
150  UINT getNumRandomSplits() const;
151 
158  UINT getMinNumSamplesPerNode() const;
159 
165  UINT getMaxDepth() const;
166 
172  UINT getTrainingMode() const;
173 
174  const vector< DecisionTreeNode* > getForest() const;
175 
183  bool getRemoveFeaturesAtEachSpilt() const;
184 
191 
198  bool setForestSize(const UINT forestSize);
199 
209  bool setNumRandomSplits(const UINT numSplittingSteps);
210 
219  bool setMinNumSamplesPerNode(const UINT minNumSamplesPerNode);
220 
228  bool setMaxDepth(const UINT maxDepth);
229 
238  bool setRemoveFeaturesAtEachSpilt(const bool removeFeaturesAtEachSpilt);
239 
246  bool setTrainingMode(const UINT trainingMode);
247 
253  bool setDecisionTreeNode( const DecisionTreeNode &node );
254 
255  //Tell the compiler we are using the base class train method to stop hidden virtual function warnings
258 
259 protected:
260 
261  UINT forestSize;
262  UINT numRandomSplits;
263  UINT minNumSamplesPerNode;
264  UINT maxDepth;
265  UINT trainingMode;
266  bool removeFeaturesAtEachSpilt;
267  DecisionTreeNode* decisionTreeNode;
268  vector< DecisionTreeNode* > forest;
269 
270 private:
271  static RegisterClassifierModule< RandomForests > registerModule;
272 
273 };
274 
275 } //End of namespace GRT
276 
277 #endif //GRT_RANDOM_FORESTS_HEADER
278 
virtual bool deepCopyFrom(const Classifier *classifier)
virtual ~RandomForests(void)
virtual bool saveModelToFile(string filename) const
Definition: MLBase.cpp:135
virtual bool print() const
bool getRemoveFeaturesAtEachSpilt() const
bool setMinNumSamplesPerNode(const UINT minNumSamplesPerNode)
virtual bool loadModelFromFile(string filename)
Definition: MLBase.cpp:157
bool setNumRandomSplits(const UINT numSplittingSteps)
Definition: AdaBoost.cpp:25
bool setDecisionTreeNode(const DecisionTreeNode &node)
RandomForests & operator=(const RandomForests &rhs)
virtual bool loadModelFromFile(fstream &file)
virtual bool saveModelToFile(fstream &file) const
virtual bool clear()
bool setRemoveFeaturesAtEachSpilt(const bool removeFeaturesAtEachSpilt)
virtual bool predict_(VectorDouble &inputVector)
UINT getMinNumSamplesPerNode() const
bool setForestSize(const UINT forestSize)
UINT getTrainingMode() const
UINT getMaxDepth() const
virtual bool train_(ClassificationData &trainingData)
UINT getNumRandomSplits() const
RandomForests(const DecisionTreeNode &decisionTreeNode=DecisionTreeClusterNode(), const UINT forestSize=10, const UINT numRandomSplits=100, const UINT minNumSamplesPerNode=5, const UINT maxDepth=10, const UINT trainingMode=DecisionTree::BEST_RANDOM_SPLIT, const bool removeFeaturesAtEachSpilt=true, const bool useScaling=false)
UINT getForestSize() const
bool setMaxDepth(const UINT maxDepth)
DecisionTreeNode * deepCopyDecisionTreeNode() const
bool setTrainingMode(const UINT trainingMode)