DecisionNode struct
#include <DecisionNode.h>
DecisionNodes can either be branches or leafs. Branch nodes store data used to instruct the traversal of the decision tree. The data used for traversal are a column index of a DataFrame and a row value. Both of these are used for comparison with new data to go left (true) or right (false). Leaf nodes contain data used for prediction.
Contents
Constructors, destructors, conversion operators
- DecisionNode(double splitLoss, std::vector<double> values, int splitColumn = 0, Generic* splitValue = nullptr, DecisionNode* left = nullptr, DecisionNode* right = nullptr)
- Construct a new DecisionNode object.
Public functions
- auto isLeaf() -> bool
- Determines whethers node is a leaf node.
Public variables
- DecisionNode* left
- DecisionNode* right
- int splitColumn
- Generic* splitValue
- double splitLoss
- int sampleSize
- std::vector<double> values
Function documentation
DecisionNode:: DecisionNode(double splitLoss,
std::vector<double> values,
int splitColumn = 0,
Generic* splitValue = nullptr,
DecisionNode* left = nullptr,
DecisionNode* right = nullptr)
Construct a new DecisionNode object.
Parameters | |
---|---|
splitLoss | Used for optimizing the fit of a decision tree. |
values | An array containing the expected value (mean) or the counts of each class for DecisionTreeRegressor and DecisionTreeClassifier, respectively. |
splitColumn | The column index used for splitting the node. |
splitValue | The row value used for splitting the node. |
left | The node that represents true for comparison. |
right | The node that represents false for comparison. |