35 #ifndef GRT_RANDOM_FORESTS_HEADER
36 #define GRT_RANDOM_FORESTS_HEADER
38 #include "../DecisionTree/DecisionTree.h"
58 const UINT forestSize=10,
59 const UINT numRandomSplits=100,
60 const UINT minNumSamplesPerNode=5,
61 const UINT maxDepth=10,
62 const UINT trainingMode = DecisionTree::BEST_RANDOM_SPLIT,
63 const bool removeFeaturesAtEachSpilt =
true,
64 const bool useScaling=
false,
65 const Float bootstrappedDatasetWeight = 0.8);
119 virtual bool clear();
126 virtual bool print()
const;
135 virtual bool save( std::fstream &file )
const;
144 virtual bool load( std::fstream &file );
161 UINT getForestSize()
const;
168 UINT getNumRandomSplits()
const;
176 UINT getMinNumSamplesPerNode()
const;
183 UINT getMaxDepth()
const;
190 UINT getTrainingMode()
const;
206 bool getRemoveFeaturesAtEachSpilt()
const;
214 Float getBootstrappedDatasetWeight()
const;
243 VectorDouble getFeatureWeights(
const bool normWeights =
true )
const;
257 MatrixDouble getLeafNodeFeatureWeights(
const bool normWeights =
true )
const;
265 bool setForestSize(
const UINT forestSize);
276 bool setNumRandomSplits(
const UINT numSplittingSteps);
286 bool setMinNumSamplesPerNode(
const UINT minNumSamplesPerNode);
295 bool setMaxDepth(
const UINT maxDepth);
305 bool setRemoveFeaturesAtEachSpilt(
const bool removeFeaturesAtEachSpilt);
313 bool setTrainingMode(
const UINT trainingMode);
329 bool setBootstrappedDatasetWeight(
const Float bootstrappedDatasetWeight );
336 static std::string getId();
345 UINT numRandomSplits;
346 UINT minNumSamplesPerNode;
349 bool removeFeaturesAtEachSpilt;
350 Float bootstrappedDatasetWeight;
356 static std::string id;
362 #endif //GRT_RANDOM_FORESTS_HEADER
virtual bool predict_(VectorFloat &inputVector)
virtual bool save(const std::string filename) const
virtual bool load(const std::string filename)
virtual bool deepCopyFrom(const Classifier *classifier)
virtual bool print() const
virtual bool train_(ClassificationData &trainingData)