Non-terminal node, which splits data depending on a threshold value of some feature. More...
#include <DecisionTreeNodes.hpp>
Public Types | |
using | arg_type = typename Node< Y >::arg_type |
Public Member Functions | |
SplitNode (double n_error, Y n_value, SplitNode< Y > *n_parent, double n_threshold, unsigned int n_feature_index) | |
Constructor. More... | |
Y | operator() (arg_type x) const override |
Returns a prediction given a feature vector. More... | |
unsigned int | count_lower_nodes () const override |
Total number of nodes reachable from this one. More... | |
unsigned int | count_leaf_nodes () const override |
Total number of leaf nodes reachable from this one, including itself. More... | |
double | total_leaf_error () const override |
Total error of the training samples seen by the leaf nodes reachable from this node (including its own if leaf). More... | |
SplitNode< Y > * | clone (SplitNode< Y > *cloned_parent) const override |
Make a perfect copy of the node. Function works recursively from root to leafs. More... | |
bool | is_leaf () const override |
Return true if node is a leaf. More... | |
void | collect_lowest_split_nodes (std::unordered_set< SplitNode< Y > * > &s) override |
Adds all lowest split nodes. More... | |
Public Attributes | |
std::unique_ptr< Node< Y > > | lower |
std::unique_ptr< Node< Y > > | higher |
double | threshold |
unsigned int | feature_index |
Non-terminal node, which splits data depending on a threshold value of some feature.
using ml::DecisionTrees::SplitNode< Y >::arg_type = typename Node<Y>::arg_type |
Type for feature vector.
|
inline |
Constructor.
[in] | n_error | Prediction error value on training data which reached this node. |
[in] | n_value | Prediction value assigned to this node. |
[in] | n_parent | Link to parent node. |
[in] | n_threshold | Split threshold value. |
[in] | n_feature_index | Index of the feature on which this node splits data. |
std::domain_error | If n_error < 0 . |
|
inlineoverride |
Returns a prediction given a feature vector.
x | Feature vector. |
|
inlineoverride |
Total number of nodes reachable from this one.
|
inlineoverride |
Total number of leaf nodes reachable from this one, including itself.
|
inlineoverride |
Total error of the training samples seen by the leaf nodes reachable from this node (including its own if leaf).
Has the invariant total_leaf_error() <= error
.
|
inlineoverride |
Make a perfect copy of the node. Function works recursively from root to leafs.
[in] | cloned_parent | Pointer to already cloned parent. |
|
inlineoverride |
Return true if node is a leaf.
|
inlineoverride |
Adds all lowest split nodes.
Walks over this node and all below it, adding to s
every split node which has only leaf nodes as children.
[out] | s | Set of pointers to split nodes. |
std::unique_ptr<Node<Y> > ml::DecisionTrees::SplitNode< Y >::lower |
Followed if x[feature_index] < threshold
.
std::unique_ptr<Node<Y> > ml::DecisionTrees::SplitNode< Y >::higher |
Followed if x[feature_index] >= threshold
.
double ml::DecisionTrees::SplitNode< Y >::threshold |
Split threshold value.
unsigned int ml::DecisionTrees::SplitNode< Y >::feature_index |
Index of the feature on which this node splits data.