Terminal node, which returns a constant prediction value for features which ended up on it. More...
#include <DecisionTreeNodes.hpp>


Public Types | |
| using | arg_type = typename Node< Y >::arg_type |
Public Types inherited from ml::DecisionTrees::Node< Y > | |
| typedef Eigen::Ref< const Eigen::VectorXd > | arg_type |
Public Member Functions | |
| LeafNode (double n_error, Y n_value, SplitNode< Y > *n_parent) | |
| Constructor. More... | |
| Y | operator() (arg_type) 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. | |
| unsigned int | count_leaf_nodes () const override |
| Total number of leaf nodes reachable from this one, including itself. | |
| 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... | |
| LeafNode * | 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. | |
| void | collect_lowest_split_nodes (std::unordered_set< SplitNode< Y > * > &) override |
| Adds all lowest split nodes. More... | |
Public Member Functions inherited from ml::DecisionTrees::Node< Y > | |
| Node (double n_error, Y n_value, SplitNode< Y > *n_parent) | |
| Constructor. More... | |
| virtual | ~Node () |
| Virtual destructor. | |
Additional Inherited Members | |
Public Attributes inherited from ml::DecisionTrees::Node< Y > | |
| double | error |
| Y | value |
| SplitNode< Y > * | parent |
Terminal node, which returns a constant prediction value for features which ended up on it.
| using ml::DecisionTrees::LeafNode< Y >::arg_type = typename Node<Y>::arg_type |
Type for feature vector.
|
inline |
Constructor.
| n_error | Prediction error value on training data which reached this node. |
| n_value | Prediction value assigned to this node. |
| n_parent | Link to parent node. |
| std::domain_error | If n_error < 0. |
|
inlineoverridevirtual |
Returns a prediction given a feature vector.
| x | Feature vector. |
Implements ml::DecisionTrees::Node< Y >.
|
inlineoverridevirtual |
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.
Implements ml::DecisionTrees::Node< Y >.
|
inlineoverridevirtual |
Make a perfect copy of the node. Function works recursively from root to leafs.
| [in] | cloned_parent | Pointer to already cloned parent. |
Implements ml::DecisionTrees::Node< Y >.
|
inlineoverridevirtual |
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. |
Implements ml::DecisionTrees::Node< Y >.