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

Visitor that routes observations through the tree and collects per-node projection data for histogram rendering. More...

#include <Visualization.hpp>

Public Member Functions

 NodeDataVisitor (types::FeatureMatrix const &x, types::OutcomeVector const &y)
 
void visit (TreeBranch const &node) override
 
void visit (TreeLeaf const &node) override
 
- Public Member Functions inherited from ppforest2::TreeNode::Visitor
virtual ~Visitor ()=default
 

Public Attributes

int depth
 Current depth in the traversal.
 
std::vector< int > indices
 Indices of observations reaching the current node.
 
std::vector< NodeDatanodes
 Collected node data (pre-order).
 
types::FeatureMatrix const & x
 Full observation matrix (n × p).
 
types::OutcomeVector const & y
 Full response vector (n).
 

Detailed Description

Visitor that routes observations through the tree and collects per-node projection data for histogram rendering.

Usage:

NodeDataVisitor visitor(x, y);
tree.root->accept(visitor);
// visitor.nodes is a pre-order vector of NodeData
types::FeatureMatrix const & x
Full observation matrix (n × p).
Definition Visualization.hpp:119
types::OutcomeVector const & y
Full response vector (n).
Definition Visualization.hpp:120
NodeDataVisitor(types::FeatureMatrix const &x, types::OutcomeVector const &y)

At each split node the visitor projects all reaching observations onto the node's projector, records the projected values and group labels, partitions observation indices by the cutpoint, and recurses into the lower and upper children. Nodes are accumulated in pre-order (parent before children, left before right).

The observation routing respects the tree structure exactly: an observation reaching a split goes to the lower child if its projected value < cutpoint, otherwise to the upper child.

Constructor & Destructor Documentation

◆ NodeDataVisitor()

ppforest2::viz::NodeDataVisitor::NodeDataVisitor ( types::FeatureMatrix const & x,
types::OutcomeVector const & y )

Member Function Documentation

◆ visit() [1/2]

void ppforest2::viz::NodeDataVisitor::visit ( TreeBranch const & node)
overridevirtual

Reimplemented from ppforest2::TreeNode::Visitor.

◆ visit() [2/2]

void ppforest2::viz::NodeDataVisitor::visit ( TreeLeaf const & node)
overridevirtual

Reimplemented from ppforest2::TreeNode::Visitor.

Member Data Documentation

◆ depth

int ppforest2::viz::NodeDataVisitor::depth

Current depth in the traversal.

◆ indices

std::vector<int> ppforest2::viz::NodeDataVisitor::indices

Indices of observations reaching the current node.

◆ nodes

std::vector<NodeData> ppforest2::viz::NodeDataVisitor::nodes

Collected node data (pre-order).

◆ x

types::FeatureMatrix const& ppforest2::viz::NodeDataVisitor::x

Full observation matrix (n × p).

◆ y

types::OutcomeVector const& ppforest2::viz::NodeDataVisitor::y

Full response vector (n).


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