21 #define GRT_DLL_EXPORTS 26 Tree::Tree(
const UINT numSplittingSteps,
const UINT minNumSamplesPerNode,
const UINT maxDepth,
const bool removeFeaturesAtEachSpilt,
const TrainingMode trainingMode) :
MLBase(
"Tree")
29 this->numSplittingSteps = numSplittingSteps;
30 this->minNumSamplesPerNode = minNumSamplesPerNode;
31 this->maxDepth = maxDepth;
32 this->removeFeaturesAtEachSpilt = removeFeaturesAtEachSpilt;
33 this->trainingMode = trainingMode;
53 std::ostringstream stream;
56 std::cout << stream.str();
92 return numSplittingSteps;
96 return minNumSamplesPerNode;
113 return removeFeaturesAtEachSpilt;
117 if( trainingMode >= BEST_ITERATIVE_SPILT && trainingMode < NUM_TRAINING_MODES ){
118 this->trainingMode = trainingMode;
121 warningLog << __GRT_LOG__ <<
" Unknown trainingMode: " << trainingMode << std::endl;
126 if( numSplittingSteps > 0 ){
127 this->numSplittingSteps = numSplittingSteps;
130 warningLog << __GRT_LOG__ <<
" The number of splitting steps must be greater than zero!" << std::endl;
135 if( minNumSamplesPerNode > 0 ){
136 this->minNumSamplesPerNode = minNumSamplesPerNode;
139 warningLog << __GRT_LOG__ <<
" The minimum number of samples per node must be greater than zero!" << std::endl;
145 this->maxDepth = maxDepth;
148 warningLog << __GRT_LOG__ <<
" The maximum depth must be greater than zero!" << std::endl;
153 this->removeFeaturesAtEachSpilt = removeFeaturesAtEachSpilt;
bool setRemoveFeaturesAtEachSpilt(const bool removeFeaturesAtEachSpilt)
virtual bool getModel(std::ostream &stream) const override
bool setMinNumSamplesPerNode(const UINT minNumSamplesPerNode)
UINT getNumSplittingSteps() const
bool setTrainingMode(const TrainingMode trainingMode)
bool setNumSplittingSteps(const UINT numSplittingSteps)
virtual bool getModel(std::ostream &stream) const override
bool getRemoveFeaturesAtEachSpilt() const
UINT getTrainingMode() const
const Node * getTree() const
bool setMaxDepth(const UINT maxDepth)
UINT getPredictedNodeID() const
virtual bool print() const override
virtual bool clear() override
This class implements the base class Tree used for the DecisionTree, RegressionTree and ClusterTree...
virtual Node * deepCopyTree() const
UINT getMinNumSamplesPerNode() const
virtual bool clear() override
This is the main base class that all GRT machine learning algorithms should inherit from...
UINT getPredictedNodeID() const
Tree(const UINT numSplittingSteps=100, const UINT minNumSamplesPerNode=5, const UINT maxDepth=10, const bool removeFeaturesAtEachSpilt=false, const TrainingMode trainingMode=BEST_ITERATIVE_SPILT)
virtual Node * deepCopy() const