ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::TreeLeaf Class Reference

Leaf node in a projection pursuit tree. More...

#include <TreeLeaf.hpp>

Public Types

using Ptr = std::unique_ptr<TreeLeaf>
 
- Public Types inherited from ppforest2::TreeNode
using Ptr = std::unique_ptr<TreeNode>
 

Public Member Functions

 TreeLeaf (types::Outcome value)
 
void accept (TreeNode::Visitor &visitor) const override
 Accept a tree node visitor (double dispatch).
 
TreeNode::Ptr clone () const override
 Deep copy of this node and its subtree.
 
bool equals (TreeNode const &other) const override
 Structural equality comparison (value-based).
 
int group_count () const override
 Number of distinct groups reachable from this node.
 
std::set< types::GroupIdnode_groups () const override
 Sorted set of group labels reachable from this node.
 
types::Outcome predict (types::FeatureVector const &x) const override
 Return the stored class label (ignores input).
 
types::Outcome response () const override
 The group label at this node (leaf value or majority group).
 
- Public Member Functions inherited from ppforest2::TreeNode
virtual ~TreeNode ()=default
 
bool operator!= (TreeNode const &other) const
 
bool operator== (TreeNode const &other) const
 

Static Public Member Functions

static Ptr make (types::Outcome value)
 Factory method that returns a unique_ptr to a new TreeLeaf.
 

Public Attributes

types::Outcome value
 Class label stored at this leaf.
 
- Public Attributes inherited from ppforest2::TreeNode
bool degenerate = false
 Whether this node (or any descendant) had a degenerate split.
 

Detailed Description

Leaf node in a projection pursuit tree.

Holds a single class label and always returns it as the prediction, regardless of the input feature vector.

Member Typedef Documentation

◆ Ptr

using ppforest2::TreeLeaf::Ptr = std::unique_ptr<TreeLeaf>

Constructor & Destructor Documentation

◆ TreeLeaf()

ppforest2::TreeLeaf::TreeLeaf ( types::Outcome value)
explicit

Member Function Documentation

◆ accept()

void ppforest2::TreeLeaf::accept ( TreeNode::Visitor & visitor) const
overridevirtual

Accept a tree node visitor (double dispatch).

Implements ppforest2::TreeNode.

◆ clone()

TreeNode::Ptr ppforest2::TreeLeaf::clone ( ) const
overridevirtual

Deep copy of this node and its subtree.

Implements ppforest2::TreeNode.

◆ equals()

bool ppforest2::TreeLeaf::equals ( TreeNode const & other) const
overridevirtual

Structural equality comparison (value-based).

Implements ppforest2::TreeNode.

◆ group_count()

int ppforest2::TreeLeaf::group_count ( ) const
inlineoverridevirtual

Number of distinct groups reachable from this node.

Implements ppforest2::TreeNode.

◆ make()

static Ptr ppforest2::TreeLeaf::make ( types::Outcome value)
static

Factory method that returns a unique_ptr to a new TreeLeaf.

◆ node_groups()

std::set< types::GroupId > ppforest2::TreeLeaf::node_groups ( ) const
inlineoverridevirtual

Sorted set of group labels reachable from this node.

Implements ppforest2::TreeNode.

◆ predict()

types::Outcome ppforest2::TreeLeaf::predict ( types::FeatureVector const & x) const
overridevirtual

Return the stored class label (ignores input).

Parameters
xFeature vector (unused).
Returns
The class label stored at this leaf.

Implements ppforest2::TreeNode.

◆ response()

types::Outcome ppforest2::TreeLeaf::response ( ) const
overridevirtual

The group label at this node (leaf value or majority group).

Implements ppforest2::TreeNode.

Member Data Documentation

◆ value

types::Outcome ppforest2::TreeLeaf::value

Class label stored at this leaf.


The documentation for this class was generated from the following file: