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

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

#include <TreeCondition.hpp>

Public Types

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

Public Member Functions

 TreeCondition (pp::Projector projector, Threshold threshold, TreeNode::Ptr lower, TreeNode::Ptr upper, std::set< types::Response > 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.
 
bool is_leaf () const override
 Whether this node is a leaf (TreeResponse).
 
std::set< types::Responsenode_groups () const override
 Sorted set of group labels reachable from this node.
 
types::Response predict (types::FeatureVector const &data) const override
 Route an observation through this split.
 
types::Response 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, Threshold threshold, TreeNode::Ptr lower, TreeNode::Ptr upper, std::set< types::Response > groups={}, types::Feature pp_index_value=0)
 Factory method that returns a unique_ptr to a new TreeCondition.
 

Public Attributes

std::set< types::Responsegroups
 Set of group labels reachable from this node.
 
TreeNode::Ptr lower
 Child node for observations with projected value < threshold.
 
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.
 
Threshold threshold
 Split threshold on the projected value.
 
TreeNode::Ptr upper
 Child node for observations with projected value ≥ threshold.
 
- 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 threshold. If the projected value is below the threshold the observation goes to the lower child; otherwise to upper.

Member Typedef Documentation

◆ Ptr

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

Constructor & Destructor Documentation

◆ TreeCondition()

ppforest2::TreeCondition::TreeCondition ( pp::Projector projector,
Threshold threshold,
TreeNode::Ptr lower,
TreeNode::Ptr upper,
std::set< types::Response > groups = {},
types::Feature pp_index_value = 0 )

Member Function Documentation

◆ accept()

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

Accept a tree node visitor (double dispatch).

Implements ppforest2::TreeNode.

◆ clone()

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

Deep copy of this node and its subtree.

Implements ppforest2::TreeNode.

◆ equals()

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

Structural equality comparison (value-based).

Implements ppforest2::TreeNode.

◆ group_count()

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

Number of distinct groups reachable from this node.

Implements ppforest2::TreeNode.

◆ is_leaf()

bool ppforest2::TreeCondition::is_leaf ( ) const
inlineoverridevirtual

Whether this node is a leaf (TreeResponse).

Implements ppforest2::TreeNode.

◆ make()

static Ptr ppforest2::TreeCondition::make ( pp::Projector projector,
Threshold threshold,
TreeNode::Ptr lower,
TreeNode::Ptr upper,
std::set< types::Response > groups = {},
types::Feature pp_index_value = 0 )
static

Factory method that returns a unique_ptr to a new TreeCondition.

◆ node_groups()

std::set< types::Response > ppforest2::TreeCondition::node_groups ( ) const
inlineoverridevirtual

Sorted set of group labels reachable from this node.

Implements ppforest2::TreeNode.

◆ predict()

types::Response ppforest2::TreeCondition::predict ( types::FeatureVector const & data) const
overridevirtual

Route an observation through this split.

Projects data onto the projector, compares against the threshold, and delegates to the appropriate child node.

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

Implements ppforest2::TreeNode.

◆ response()

types::Response ppforest2::TreeCondition::response ( ) const
overridevirtual

Returns the response of the lower child.

Implements ppforest2::TreeNode.

Member Data Documentation

◆ groups

std::set<types::Response> ppforest2::TreeCondition::groups

Set of group labels reachable from this node.

◆ lower

TreeNode::Ptr ppforest2::TreeCondition::lower

Child node for observations with projected value < threshold.

◆ pp_index_value

types::Feature ppforest2::TreeCondition::pp_index_value = 0

Projection pursuit index value achieved at this split.

◆ projector

pp::Projector ppforest2::TreeCondition::projector

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

◆ threshold

Threshold ppforest2::TreeCondition::threshold

Split threshold on the projected value.

◆ upper

TreeNode::Ptr ppforest2::TreeCondition::upper

Child node for observations with projected value ≥ threshold.


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