30 #ifndef GRT_NODE_HEADER
31 #define GRT_NODE_HEADER
33 #include "../../CoreModules/GRTBase.h"
56 virtual bool predict(
const VectorDouble &x);
66 virtual bool predict(
const VectorDouble &x,VectorDouble &y);
82 virtual bool print()
const;
91 virtual bool getModel(ostream &stream)
const;
146 UINT getMaxDepth()
const;
176 Node *getParent()
const {
return parent; }
177 Node *getLeftChild()
const {
return leftChild; }
178 Node *getRightChild()
const {
return rightChild; }
180 bool initNode(
Node *parent,
const UINT depth,
const UINT nodeID,
const bool isLeafNode =
false);
182 bool setParent(
Node *parent);
184 bool setLeftChild(
Node *leftChild);
186 bool setRightChild(
Node *rightChild);
188 bool setDepth(
const UINT depth);
190 bool setNodeID(
const UINT nodeID);
192 bool setIsLeafNode(
const bool isLeafNode);
243 UINT predictedNodeID;
249 static StringNodeMap *getMap() {
251 return stringNodeMap;
255 static StringNodeMap *stringNodeMap;
256 static UINT numNodeInstances;
261 template<
typename T > Node* getNewNodeInstance() {
return new T; }
263 template<
typename T >
267 getMap()->insert( std::pair<
string,
Node*(*)()>(newNodeName, &getNewNodeInstance< T > ) );
273 #endif //GRT_NODE_HEADER
virtual Node * deepCopyNode() const
UINT getPredictedNodeID() const
bool getHasLeftChild() const
virtual bool loadFromFile(fstream &file)
virtual bool saveToFile(fstream &file) const
virtual bool getModel(ostream &stream) const
string getNodeType() const
virtual bool loadParametersFromFile(fstream &file)
virtual bool saveParametersToFile(fstream &file) const
std::map< string, Node *(*)() > StringNodeMap
virtual bool predict(const VectorDouble &x)
Node * createNewInstance() const
bool getHasParent() const
bool getIsLeafNode() const
static Node * createInstanceFromString(string const &nodeType)
bool getHasRightChild() const
virtual bool print() const