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

Base class for visitors that traverse a tree in a 2D feature plane. More...

#include <Visualization.hpp>

Public Member Functions

 SpatialVisitor (int var_i, int var_j, std::vector< std::pair< int, types::Feature > > const &fixed_vars, types::Feature x_min, types::Feature x_max, types::Feature y_min, types::Feature y_max)
 
void visit (TreeBranch const &node) override
 Push constraint, recurse into children, pop.
 
void visit (TreeLeaf const &node) override
 No-op default; override in subclasses that need leaf work.
 
- Public Member Functions inherited from ppforest2::TreeNode::Visitor
virtual ~Visitor ()=default
 

Public Attributes

std::vector< HalfSpaceconstraints
 Accumulated ancestor half-space constraints.
 
int depth
 
std::vector< std::pair< int, types::Feature > > fixed_vars
 Fixed (index, value) pairs.
 
int var_i
 
int var_j
 Indices of the two displayed feature variables.
 
types::Feature x_max
 
types::Feature x_min
 
types::Feature y_max
 Visible bounding box.
 
types::Feature y_min
 

Detailed Description

Base class for visitors that traverse a tree in a 2D feature plane.

Holds the shared state for projecting p-dimensional splits into (var_i, var_j) space with the remaining variables fixed: the two display variable indices, fixed variable values, the visible bounding box, and the stack of ancestor half-space constraints.

Implements the common traversal logic in visit(TreeBranch): push the current split as a constraint, recurse into both children (lower then upper), and pop. Subclasses override visit_branch() to do work at each split node (e.g. clip and emit a boundary segment) and visit(TreeLeaf) for leaf-specific work.

Constructor & Destructor Documentation

◆ SpatialVisitor()

ppforest2::viz::SpatialVisitor::SpatialVisitor ( int var_i,
int var_j,
std::vector< std::pair< int, types::Feature > > const & fixed_vars,
types::Feature x_min,
types::Feature x_max,
types::Feature y_min,
types::Feature y_max )

Member Function Documentation

◆ visit() [1/2]

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

Push constraint, recurse into children, pop.

Subclasses that need per-node work (e.g. BoundaryVisitor) override this, do their work, then call SpatialVisitor::visit(node) for the traversal.

Reimplemented from ppforest2::TreeNode::Visitor.

◆ visit() [2/2]

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

No-op default; override in subclasses that need leaf work.

Reimplemented from ppforest2::TreeNode::Visitor.

Member Data Documentation

◆ constraints

std::vector<HalfSpace> ppforest2::viz::SpatialVisitor::constraints

Accumulated ancestor half-space constraints.

◆ depth

int ppforest2::viz::SpatialVisitor::depth

◆ fixed_vars

std::vector<std::pair<int, types::Feature> > ppforest2::viz::SpatialVisitor::fixed_vars

Fixed (index, value) pairs.

◆ var_i

int ppforest2::viz::SpatialVisitor::var_i

◆ var_j

int ppforest2::viz::SpatialVisitor::var_j

Indices of the two displayed feature variables.

◆ x_max

types::Feature ppforest2::viz::SpatialVisitor::x_max

◆ x_min

types::Feature ppforest2::viz::SpatialVisitor::x_min

◆ y_max

types::Feature ppforest2::viz::SpatialVisitor::y_max

Visible bounding box.

◆ y_min

types::Feature ppforest2::viz::SpatialVisitor::y_min

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