30 #ifndef GRT_NODE_HEADER
31 #define GRT_NODE_HEADER
33 #include "../../CoreModules/GRTBase.h"
100 virtual bool print()
const;
109 virtual bool getModel( std::ostream &stream )
const;
117 virtual bool saveToFile( std::fstream &file )
const;
164 UINT getMaxDepth()
const;
194 Node *getParent()
const {
return parent; }
195 Node *getLeftChild()
const {
return leftChild; }
196 Node *getRightChild()
const {
return rightChild; }
198 bool initNode(
Node *parent,
const UINT depth,
const UINT nodeID,
const bool isLeafNode =
false);
200 bool setParent(
Node *parent);
202 bool setLeftChild(
Node *leftChild);
204 bool setRightChild(
Node *rightChild);
206 bool setDepth(
const UINT depth);
208 bool setNodeID(
const UINT nodeID);
210 bool setIsLeafNode(
const bool isLeafNode);
252 std::string nodeType;
255 UINT predictedNodeID;
261 static StringNodeMap *getMap() {
263 return stringNodeMap;
267 static StringNodeMap *stringNodeMap;
268 static UINT numNodeInstances;
273 template<
typename T >
Node* getNewNodeInstance() {
return new T; }
275 template<
typename T >
279 getMap()->insert( std::pair< std::string,
Node*(*)() >(newNodeName, &getNewNodeInstance< T > ) );
285 #endif //GRT_NODE_HEADER
virtual bool print() const
std::string getNodeType() const
virtual bool getModel(std::ostream &stream) const
virtual Node * deepCopyNode() const
bool getIsLeafNode() const
virtual bool loadParametersFromFile(std::fstream &file)
virtual bool saveToFile(std::fstream &file) const
virtual bool saveParametersToFile(std::fstream &file) const
virtual bool loadFromFile(std::fstream &file)
bool getHasParent() const
virtual bool computeFeatureWeights(VectorFloat &weights) const
Node * createNewInstance() const
UINT getPredictedNodeID() const
static Node * createInstanceFromString(std::string const &nodeType)
virtual bool computeLeafNodeWeights(MatrixFloat &weights) const
std::map< std::string, Node *(*)() > StringNodeMap
virtual bool predict(const VectorFloat &x)
bool getHasRightChild() const
bool getHasLeftChild() const