31 #ifndef GRT_DECISION_TREE_NODE_HEADER
32 #define GRT_DECISION_TREE_NODE_HEADER
34 #include "../../CoreAlgorithms/Tree/Node.h"
35 #include "../../CoreAlgorithms/Tree/Tree.h"
36 #include "../../DataStructures/ClassificationData.h"
98 virtual bool getModel( std::ostream &stream )
const;
162 static UINT getClassLabelIndexValue(UINT classLabel,
const Vector< UINT > &classLabels);
169 errorLog <<
"computeBestSpiltBestIterativeSpilt(...) - Base class not overwritten!" << std::endl;
176 errorLog <<
"computeBestSpiltBestRandomSpilt(...) - Base class not overwritten!" << std::endl;
190 if( !file.is_open() )
192 errorLog <<
"saveParametersToFile(fstream &file) - File is not open!" << std::endl;
197 file <<
"NodeSize: " << nodeSize << std::endl;
198 file <<
"NumClasses: " << classProbabilities.size() << std::endl;
199 file <<
"ClassProbabilities: ";
200 if( classProbabilities.size() > 0 ){
201 for(UINT i=0; i<classProbabilities.size(); i++){
202 file << classProbabilities[i];
203 if( i < classProbabilities.size()-1 ) file <<
"\t";
204 else file << std::endl;
219 if( !file.is_open() )
221 errorLog <<
"loadParametersFromFile(fstream &file) - File is not open!" << std::endl;
225 classProbabilities.clear();
232 if( word !=
"NodeSize:" ){
233 errorLog <<
"loadParametersFromFile(fstream &file) - Failed to find NodeSize header!" << std::endl;
239 if( word !=
"NumClasses:" ){
240 errorLog <<
"loadParametersFromFile(fstream &file) - Failed to find NumClasses header!" << std::endl;
245 classProbabilities.
resize( numClasses );
248 if( word !=
"ClassProbabilities:" ){
249 errorLog <<
"loadParametersFromFile(fstream &file) - Failed to find ClassProbabilities header!" << std::endl;
252 if( numClasses > 0 ){
253 for(UINT i=0; i<numClasses; i++){
254 file >> classProbabilities[i];
269 #endif //GRT_DECISION_TREE_NODE_HEADER
virtual bool computeBestSpilt(const UINT &trainingMode, const UINT &numSplittingSteps, const ClassificationData &trainingData, const Vector< UINT > &features, const Vector< UINT > &classLabels, UINT &featureIndex, Float &minError)
virtual bool resize(const unsigned int size)
bool setClassProbabilities(const VectorFloat &classProbabilities)
UINT getNumClasses() const
virtual bool saveParametersToFile(std::fstream &file) const
virtual bool predict(const VectorFloat &x, VectorFloat &classLikelihoods)
bool setLeafNode(const UINT nodeSize, const VectorFloat &classProbabilities)
DecisionTreeNode * deepCopy() const
virtual Node * deepCopyNode() const
virtual ~DecisionTreeNode()
virtual bool loadParametersFromFile(std::fstream &file)
virtual bool getModel(std::ostream &stream) const
VectorFloat getClassProbabilities() const
bool setNodeSize(const UINT nodeSize)
virtual bool predict(const VectorFloat &x)