ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
TreeLeaf.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "models/TreeNode.hpp"
4
5namespace ppforest2 {
12 class TreeLeaf : public TreeNode {
13 public:
14 using Ptr = std::unique_ptr<TreeLeaf>;
15
18
20
21 void accept(TreeNode::Visitor& visitor) const override;
22 types::Outcome response() const override;
23
31
32 int group_count() const override { return 1; }
33
34 std::set<types::GroupId> node_groups() const override { return {static_cast<types::GroupId>(value)}; }
35
36 bool equals(TreeNode const& other) const override;
37 TreeNode::Ptr clone() const override;
38
41 };
42}
std::unique_ptr< TreeLeaf > Ptr
Definition TreeLeaf.hpp:14
bool equals(TreeNode const &other) const override
Structural equality comparison (value-based).
types::Outcome value
Class label stored at this leaf.
Definition TreeLeaf.hpp:17
std::set< types::GroupId > node_groups() const override
Sorted set of group labels reachable from this node.
Definition TreeLeaf.hpp:34
int group_count() const override
Number of distinct groups reachable from this node.
Definition TreeLeaf.hpp:32
static Ptr make(types::Outcome value)
Factory method that returns a unique_ptr to a new TreeLeaf.
TreeLeaf(types::Outcome value)
TreeNode::Ptr clone() const override
Deep copy of this node and its subtree.
types::Outcome response() const override
The group label at this node (leaf value or majority group).
void accept(TreeNode::Visitor &visitor) const override
Accept a tree node visitor (double dispatch).
types::Outcome predict(types::FeatureVector const &x) const override
Return the stored class label (ignores input).
Visitor interface for tree node dispatch.
Definition TreeNode.hpp:31
Abstract base class for nodes in a projection pursuit tree.
Definition TreeNode.hpp:19
std::unique_ptr< TreeNode > Ptr
Definition TreeNode.hpp:21
Eigen::Matrix< Feature, Eigen::Dynamic, 1 > FeatureVector
Dynamic-size column vector of feature values.
Definition Types.hpp:36
Feature Outcome
Scalar type for predictions (float for both classification and regression).
Definition Types.hpp:30
int GroupId
Scalar type for internal group labels (integer). Used as map keys, set elements, and partition indice...
Definition Types.hpp:27
Binarization strategies for multiclass-to-binary reduction.
Definition Benchmark.hpp:25