Definition at line 37 of file Node.h.
Defines a map between a string (which will contain the name of the node, such as DecisionTreeNode) and a function returns a new instance of that node.
Definition at line 215 of file Node.h.
Default Constructor. Sets all the pointers to NULL.
Definition at line 43 of file Node.cpp.
Default Destructor. Cleans up any memory.
Definition at line 56 of file Node.cpp.
bool Node::computeFeatureWeights |
( |
VectorFloat & |
weights | ) |
const |
|
virtual |
This function recursively computes the weights of features used for classification nodes and stores the results in the weights vector. This function should be overwritten by the inheriting class.
- Parameters
-
weights | the input vector that will be used to store the weights |
- Returns
- returns true if the weights were updated, false otherwise
Reimplemented in DecisionTreeClusterNode.
Definition at line 101 of file Node.cpp.
bool Node::computeLeafNodeWeights |
( |
MatrixFloat & |
weights | ) |
const |
|
virtual |
This function recursively computes the weights of features used for classification nodes and stores the results in the weights vector. This function should be overwritten by the inheriting class.
- Parameters
-
weights | the input matrix that will be used to store the weights, rows represent classes, columns represent features |
- Returns
- returns true if the weights were updated, false otherwise
Reimplemented in DecisionTreeClusterNode.
Definition at line 105 of file Node.cpp.
Node * Node::createInstanceFromString |
( |
std::string const & |
nodeType | ) |
|
|
static |
Creates a new classifier instance based on the input string (which should contain the name of a valid classifier such as ANBC).
- Parameters
-
string | const &classifierType: the name of the classifier |
- Returns
- Classifier*: a pointer to the new instance of the classifier
Definition at line 29 of file Node.cpp.
Node * Node::createNewInstance |
( |
| ) |
const |
Creates a new classifier instance based on the current classifierType string value.
- Returns
- Classifier*: a pointer to the new instance of the classifier
Definition at line 39 of file Node.cpp.
Node * Node::deepCopyNode |
( |
| ) |
const |
|
virtual |
UINT Node::getDepth |
( |
| ) |
const |
This function returns the depth of the node. The depth is the level in the tree at which the node is located, the root node has a depth of 0.
- Returns
- returns the depth of the node in the tree
Definition at line 308 of file Node.cpp.
bool Node::getHasLeftChild |
( |
| ) |
const |
This function returns true if this node has a leftChild, false otherwise.
- Returns
- returns true if this node has a leftChild, false otherwise
Definition at line 351 of file Node.cpp.
bool Node::getHasParent |
( |
| ) |
const |
This function returns true if this node has a parent, false otherwise.
- Returns
- returns true if this node has a parent, false otherwise
Definition at line 347 of file Node.cpp.
bool Node::getHasRightChild |
( |
| ) |
const |
This function returns true if this node has a rightChild, false otherwise.
- Returns
- returns true if this node has a rightChild, false otherwise
Definition at line 355 of file Node.cpp.
bool Node::getIsLeafNode |
( |
| ) |
const |
This function returns true if this node is a leaf node, false otherwise.
- Returns
- returns true if this node is a leaf node, false otherwise
Definition at line 343 of file Node.cpp.
bool Node::getModel |
( |
std::ostream & |
stream | ) |
const |
|
virtual |
UINT Node::getNodeID |
( |
| ) |
const |
This function returns the nodeID, this is a unique ID that represents this node within a Tree.
- Returns
- returns the nodeID of this node
Definition at line 312 of file Node.cpp.
std::string Node::getNodeType |
( |
| ) |
const |
This function returns the node type, this is the type of node defined by the class that inherits from the Node base class.
- Returns
- returns the nodeType
Definition at line 304 of file Node.cpp.
UINT Node::getPredictedNodeID |
( |
| ) |
const |
This function returns the predictedNodeID, this is ID of the leaf node that was reached during the last prediction call
- Returns
- returns the predictedNodeID
Definition at line 316 of file Node.cpp.
bool Node::load |
( |
std::fstream & |
file | ) |
|
|
virtual |
This loads the Node from a file.
- Parameters
-
file | a reference to the file the Node model will be loaded from |
- Returns
- returns true if the model was loaded successfully, false otherwise
Definition at line 182 of file Node.cpp.
virtual bool Node::loadParametersFromFile |
( |
std::fstream & |
file | ) |
|
|
inlineprotectedvirtual |
This function recursively predicts if the probability of the input vector. This function should be overwritten by the inheriting class.
- Parameters
-
x | the input vector that will be used for the prediction |
y | a reference to a vector that will store the results |
- Returns
- returns true if the input is greater than or equal to the nodes threshold, false otherwise
Reimplemented in RegressionTreeNode, ClusterTreeNode, and DecisionTreeNode.
Definition at line 65 of file Node.cpp.
bool Node::print |
( |
| ) |
const |
|
virtual |
bool Node::save |
( |
std::fstream & |
file | ) |
const |
|
virtual |
This saves the Node to a file.
- Parameters
-
file | a reference to the file the Node model will be saved to |
- Returns
- returns true if the model was saved successfully, false otherwise
Definition at line 140 of file Node.cpp.
virtual bool Node::saveParametersToFile |
( |
std::fstream & |
file | ) |
const |
|
inlineprotectedvirtual |
The documentation for this class was generated from the following files: