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.
DecisionTreeClusterNode.h
Go to the documentation of this file.
1 
27 #ifndef GRT_DECISION_TREE_CLUSTER_NODE_HEADER
28 #define GRT_DECISION_TREE_CLUSTER_NODE_HEADER
29 
30 #include "DecisionTreeNode.h"
31 #include "../../ClusteringModules/KMeans/KMeans.h"
32 
33 GRT_BEGIN_NAMESPACE
34 
45 public:
50 
54  virtual ~DecisionTreeClusterNode();
55 
66  virtual bool predict_(VectorFloat &x) override;
67 
74  virtual bool clear() override;
75 
82  virtual bool print() const override;
83 
90  virtual bool computeFeatureWeights( VectorFloat &weights ) const override;
91 
98  virtual bool computeLeafNodeWeights( MatrixFloat &weights ) const override;
99 
107  virtual bool getModel( std::ostream &stream ) const override;
108 
115  virtual Node* deepCopy() const override;
116 
122  UINT getFeatureIndex() const;
123 
129  Float getThreshold() const;
130 
140  bool set(const UINT nodeSize,const UINT featureIndex,const Float threshold,const VectorFloat &classProbabilities);
141 
143 
144 protected:
145 
146  virtual bool computeBestSplitBestIterativeSplit( const UINT &numSplittingSteps, const ClassificationData &trainingData, const Vector< UINT > &features, const Vector< UINT > &classLabels, UINT &featureIndex, Float &minError ) override;
147 
148  virtual bool computeBestSplitBestRandomSplit( const UINT &numSplittingSteps, const ClassificationData &trainingData, const Vector< UINT > &features, const Vector< UINT > &classLabels, UINT &featureIndex, Float &minError ) override;
149 
150  bool computeSplit( const UINT &numSplittingSteps, const ClassificationData &trainingData, const Vector< UINT > &features, const Vector< UINT > &classLabels, UINT &featureIndex, Float &minError );
151 
152  bool computeError( const ClassificationData &trainingData, MatrixFloat &data, const Vector< UINT > &classLabels, Vector< MinMax > ranges, Vector< UINT > groupIndex, const UINT featureIndex, Float &threshold, Float &error );
153 
161  virtual bool saveParametersToFile( std::fstream &file ) const override;
162 
169  virtual bool loadParametersFromFile( std::fstream &file ) override;
170 
171  UINT featureIndex;
172  Float threshold;
173 
174  static RegisterNode< DecisionTreeClusterNode > registerModule;
175 };
176 
177 GRT_END_NAMESPACE
178 
179 #endif //GRT_DECISION_TREE_CLUSTER_NODE_HEADER
virtual bool clear() override
Definition: Node.h:37
virtual bool predict_(VectorFloat &x, VectorFloat &classLikelihoods) override
virtual bool loadParametersFromFile(std::fstream &file) override
virtual Node * deepCopy() const override
virtual bool saveParametersToFile(std::fstream &file) const override
virtual bool getModel(std::ostream &stream) const override
virtual bool computeFeatureWeights(VectorFloat &weights) const
Definition: Node.cpp:97
virtual bool print() const override
Definition: Node.cpp:105
virtual bool computeLeafNodeWeights(MatrixFloat &weights) const
Definition: Node.cpp:101