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

Visitor that collects and clips decision boundary line segments. 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
 
- Public Member Functions inherited from 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)
 
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< BoundarySegmentsegments
 Output: clipped boundary segments.
 
- Public Attributes inherited from ppforest2::viz::SpatialVisitor
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

Visitor that collects and clips decision boundary line segments.

Traverses the tree, projecting each split's boundary into a 2D plane defined by two feature variables (var_i, var_j). All other variables are held at fixed values to reduce the split from p-D to 2D.

Each boundary line is clipped to:

  1. The bounding box [x_min, x_max] × [y_min, y_max].
  2. All ancestor half-space constraints (so the line only appears in the region where it is actually the active decision boundary).

Usage:

BoundaryVisitor visitor(0, 1, fixed, x_min, x_max, y_min, y_max);
tree.root->accept(visitor);
// visitor.segments contains all visible boundary segments
Visitor that collects and clips decision boundary line segments.
Definition Visualization.hpp:437
types::Feature y_min
Definition Visualization.hpp:387
types::Feature x_max
Definition Visualization.hpp:387
types::Feature x_min
Definition Visualization.hpp:387
types::Feature y_max
Visible bounding box.
Definition Visualization.hpp:387

Member Function 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 )

◆ visit()

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

Reimplemented from ppforest2::TreeNode::Visitor.

Member Data Documentation

◆ segments

std::vector<BoundarySegment> ppforest2::viz::BoundaryVisitor::segments

Output: clipped boundary segments.


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