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

Internal split node in a projection pursuit tree. More...

#include <TreeBranch.hpp>

Public Types

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

Public Member Functions

 TreeBranch (pp::Projector projector, types::Feature cutpoint, TreeNode::Ptr lower, TreeNode::Ptr upper, std::set< types::GroupId > groups={}, types::Feature pp_index_value=0)
 
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
 Route an observation through this split.
 
types::Outcome response () const override
 Returns the response of the lower child.
 
- 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 (pp::Projector projector, types::Feature cutpoint, TreeNode::Ptr lower, TreeNode::Ptr upper, std::set< types::GroupId > groups={}, types::Feature pp_index_value=0)
 Factory method that returns a unique_ptr to a new TreeBranch.
 

Public Attributes

types::Feature cutpoint
 Split cutpoint on the projected value.
 
std::set< types::GroupIdgroups
 Set of group labels reachable from this node.
 
TreeNode::Ptr lower
 Child node for observations with projected value < cutpoint.
 
types::Feature pp_index_value = 0
 Projection pursuit index value achieved at this split.
 
pp::Projector projector
 Projection vector (p). Defines the linear combination of features.
 
TreeNode::Ptr upper
 Child node for observations with projected value ≥ cutpoint.
 
- Public Attributes inherited from ppforest2::TreeNode
bool degenerate = false
 Whether this node (or any descendant) had a degenerate split.
 

Detailed Description

Internal split node in a projection pursuit tree.

Projects an observation onto projector and compares the result against cutpoint. If the projected value is below the cutpoint the observation goes to the lower child; otherwise to upper.

Member Typedef Documentation

◆ Ptr

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

Constructor & Destructor Documentation

◆ TreeBranch()

ppforest2::TreeBranch::TreeBranch ( pp::Projector projector,
types::Feature cutpoint,
TreeNode::Ptr lower,
TreeNode::Ptr upper,
std::set< types::GroupId > groups = {},
types::Feature pp_index_value = 0 )

Member Function Documentation

◆ accept()

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

Accept a tree node visitor (double dispatch).

Implements ppforest2::TreeNode.

◆ clone()

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

Deep copy of this node and its subtree.

Implements ppforest2::TreeNode.

◆ equals()

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

Structural equality comparison (value-based).

Implements ppforest2::TreeNode.

◆ group_count()

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

Number of distinct groups reachable from this node.

Implements ppforest2::TreeNode.

◆ make()

static Ptr ppforest2::TreeBranch::make ( pp::Projector projector,
types::Feature cutpoint,
TreeNode::Ptr lower,
TreeNode::Ptr upper,
std::set< types::GroupId > groups = {},
types::Feature pp_index_value = 0 )
static

Factory method that returns a unique_ptr to a new TreeBranch.

◆ node_groups()

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

Sorted set of group labels reachable from this node.

Implements ppforest2::TreeNode.

◆ predict()

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

Route an observation through this split.

Projects x onto the projector, compares against the cutpoint, and delegates to the appropriate child node.

Parameters
xFeature vector (p).
Returns
Predicted group label from the reached leaf.

Implements ppforest2::TreeNode.

◆ response()

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

Returns the response of the lower child.

Implements ppforest2::TreeNode.

Member Data Documentation

◆ cutpoint

types::Feature ppforest2::TreeBranch::cutpoint

Split cutpoint on the projected value.

◆ groups

std::set<types::GroupId> ppforest2::TreeBranch::groups

Set of group labels reachable from this node.

◆ lower

TreeNode::Ptr ppforest2::TreeBranch::lower

Child node for observations with projected value < cutpoint.

◆ pp_index_value

types::Feature ppforest2::TreeBranch::pp_index_value = 0

Projection pursuit index value achieved at this split.

◆ projector

pp::Projector ppforest2::TreeBranch::projector

Projection vector (p). Defines the linear combination of features.

◆ upper

TreeNode::Ptr ppforest2::TreeBranch::upper

Child node for observations with projected value ≥ cutpoint.


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