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

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

#include <TreeResponse.hpp>

Public Types

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

Public Member Functions

 TreeResponse (types::Response 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.
 
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
 Return the stored class label (ignores input).
 
types::Response 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::Response value)
 Factory method that returns a unique_ptr to a new TreeResponse.
 

Public Attributes

types::Response 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::TreeResponse::Ptr = std::unique_ptr<TreeResponse>

Constructor & Destructor Documentation

◆ TreeResponse()

ppforest2::TreeResponse::TreeResponse ( types::Response value)
explicit

Member Function Documentation

◆ accept()

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

Accept a tree node visitor (double dispatch).

Implements ppforest2::TreeNode.

◆ clone()

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

Deep copy of this node and its subtree.

Implements ppforest2::TreeNode.

◆ equals()

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

Structural equality comparison (value-based).

Implements ppforest2::TreeNode.

◆ group_count()

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

Number of distinct groups reachable from this node.

Implements ppforest2::TreeNode.

◆ is_leaf()

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

Whether this node is a leaf (TreeResponse).

Implements ppforest2::TreeNode.

◆ make()

static Ptr ppforest2::TreeResponse::make ( types::Response value)
static

Factory method that returns a unique_ptr to a new TreeResponse.

◆ node_groups()

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

Sorted set of group labels reachable from this node.

Implements ppforest2::TreeNode.

◆ predict()

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

Return the stored class label (ignores input).

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

Implements ppforest2::TreeNode.

◆ response()

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

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

Implements ppforest2::TreeNode.

Member Data Documentation

◆ value

types::Response ppforest2::TreeResponse::value

Class label stored at this leaf.


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