ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::viz::NodeDataVisitor Struct 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::ResponseVector const &y)
 
void visit (TreeCondition const &node) override
 
void visit (TreeResponse const &node) override
 

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::ResponseVector 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:118
types::ResponseVector const & y
Full response vector (n).
Definition Visualization.hpp:119
NodeDataVisitor(types::FeatureMatrix const &x, types::ResponseVector 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 threshold, 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 < threshold, otherwise to the upper child.

Constructor & Destructor Documentation

◆ NodeDataVisitor()

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

Member Function Documentation

◆ visit() [1/2]

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

◆ visit() [2/2]

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

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::ResponseVector const& ppforest2::viz::NodeDataVisitor::y

Full response vector (n).


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