21 #define GRT_DLL_EXPORTS
26 Tree::Tree(
const UINT numSplittingSteps,
const UINT minNumSamplesPerNode,
const UINT maxDepth,
const bool removeFeaturesAtEachSpilt,
const UINT trainingMode)
29 this->numSplittingSteps = numSplittingSteps;
30 this->minNumSamplesPerNode = minNumSamplesPerNode;
31 this->maxDepth = maxDepth;
32 this->removeFeaturesAtEachSpilt = removeFeaturesAtEachSpilt;
33 this->trainingMode = trainingMode;
35 debugLog.setProceedingText(
"[DEBUG Tree]");
36 errorLog.setProceedingText(
"[ERROR Tree]");
37 trainingLog.setProceedingText(
"[TRAINING Tree]");
38 warningLog.setProceedingText(
"[WARNING Tree]");
58 std::ostringstream stream;
61 std::cout << stream.str();
97 return numSplittingSteps;
101 return minNumSamplesPerNode;
118 return removeFeaturesAtEachSpilt;
122 if( trainingMode >= BEST_ITERATIVE_SPILT && trainingMode < NUM_TRAINING_MODES ){
123 this->trainingMode = trainingMode;
126 warningLog <<
"Unknown trainingMode: " << trainingMode << std::endl;
131 if( numSplittingSteps > 0 ){
132 this->numSplittingSteps = numSplittingSteps;
135 warningLog <<
"setNumSplittingSteps(const UINT numSplittingSteps) - The number of splitting steps must be greater than zero!" << std::endl;
140 if( minNumSamplesPerNode > 0 ){
141 this->minNumSamplesPerNode = minNumSamplesPerNode;
144 warningLog <<
"setMinNumSamplesPerNode(const UINT minNumSamplesPerNode) - The minimum number of samples per node must be greater than zero!" << std::endl;
150 this->maxDepth = maxDepth;
153 warningLog <<
"setMaxDepth(const UINT maxDepth) - The maximum depth must be greater than zero!" << std::endl;
158 this->removeFeaturesAtEachSpilt = removeFeaturesAtEachSpilt;
bool setRemoveFeaturesAtEachSpilt(const bool removeFeaturesAtEachSpilt)
virtual bool getModel(std::ostream &stream) const
bool setMinNumSamplesPerNode(const UINT minNumSamplesPerNode)
virtual bool print() const
UINT getNumSplittingSteps() const
virtual bool getModel(std::ostream &stream) const
bool setNumSplittingSteps(const UINT numSplittingSteps)
bool getRemoveFeaturesAtEachSpilt() const
UINT getTrainingMode() const
virtual Node * deepCopyNode() const
const Node * getTree() const
bool setMaxDepth(const UINT maxDepth)
UINT getPredictedNodeID() const
Tree(const UINT numSplittingSteps=100, const UINT minNumSamplesPerNode=5, const UINT maxDepth=10, const bool removeFeaturesAtEachSpilt=false, const UINT trainingMode=BEST_ITERATIVE_SPILT)
This class implements the base class Tree used for the DecisionTree, RegressionTree and ClusterTree...
virtual Node * deepCopyTree() const
UINT getMinNumSamplesPerNode() const
bool setTrainingMode(const UINT trainingMode)
UINT getPredictedNodeID() const