Tree node. Nodes are split (non-terminal) or leaf (terminal).
More...
#include <DecisionTreeNodes.hpp>
|
typedef Eigen::Ref< const Eigen::VectorXd > | arg_type |
|
|
| Node (double n_error, Y n_value, SplitNode< Y > *n_parent) |
| Constructor. More...
|
|
virtual | ~Node () |
| Virtual destructor.
|
|
virtual Y | operator() (arg_type x) const =0 |
| Returns a prediction given a feature vector. More...
|
|
virtual unsigned int | count_lower_nodes () const =0 |
| Total number of nodes reachable from this one.
|
|
virtual unsigned int | count_leaf_nodes () const =0 |
| Total number of leaf nodes reachable from this one, including itself.
|
|
virtual double | total_leaf_error () const =0 |
| Total error of the training samples seen by the leaf nodes reachable from this node (including its own if leaf). More...
|
|
virtual Node * | clone (SplitNode< Y > *cloned_parent) const =0 |
| Make a perfect copy of the node. Function works recursively from root to leafs. More...
|
|
virtual bool | is_leaf () const =0 |
| Return true if node is a leaf.
|
|
virtual void | collect_lowest_split_nodes (std::unordered_set< SplitNode< Y > * > &s)=0 |
| Adds all lowest split nodes. More...
|
|
template<class Y>
struct ml::DecisionTrees::Node< Y >
Tree node. Nodes are split (non-terminal) or leaf (terminal).
- Template Parameters
-
Y | Type of predicted value (integer for classification, real for regression). |
- See also
- DecisionTree.
◆ arg_type
◆ Node()
Constructor.
- Parameters
-
[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. |
- Exceptions
-
std::domain_error | If n_error < 0 . |
◆ operator()()
◆ total_leaf_error()
◆ clone()
Make a perfect copy of the node. Function works recursively from root to leafs.
- Parameters
-
[in] | cloned_parent | Pointer to already cloned parent. |
Implemented in ml::DecisionTrees::LeafNode< Y >.
◆ collect_lowest_split_nodes()
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.
- Parameters
-
[out] | s | Set of pointers to split nodes. |
Implemented in ml::DecisionTrees::LeafNode< Y >.
◆ error
Error of the training sample seen by this node, used for pruning.
◆ value
Value which should be returned if we stop splitting at this node.
◆ parent
The documentation for this struct was generated from the following file: