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

Visitor that collects and clips decision boundary line segments. More...

#include <Visualization.hpp>

Public Member Functions

 BoundaryVisitor (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 (TreeCondition const &node) override
 
void visit (TreeResponse const &node) override
 

Public Attributes

std::vector< HalfSpaceconstraints
 Accumulated ancestor constraints.
 
int depth
 
std::vector< std::pair< int, types::Feature > > fixed_vars
 Fixed (index, value) pairs.
 
std::vector< BoundarySegmentsegments
 Output: clipped boundary segments.
 
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
BoundaryVisitor(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)
types::Feature y_min
Definition Visualization.hpp:364
types::Feature y_max
Visible bounding box.
Definition Visualization.hpp:364
types::Feature x_max
Definition Visualization.hpp:364
types::Feature x_min
Definition Visualization.hpp:364

Constructor & Destructor Documentation

◆ BoundaryVisitor()

ppforest2::viz::BoundaryVisitor::BoundaryVisitor ( 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::BoundaryVisitor::visit ( TreeCondition const & node)
overridevirtual

◆ visit() [2/2]

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

Member Data Documentation

◆ constraints

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

Accumulated ancestor constraints.

◆ depth

int ppforest2::viz::BoundaryVisitor::depth

◆ fixed_vars

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

Fixed (index, value) pairs.

◆ segments

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

Output: clipped boundary segments.

◆ var_i

int ppforest2::viz::BoundaryVisitor::var_i

◆ var_j

int ppforest2::viz::BoundaryVisitor::var_j

Indices of the two displayed feature variables.

◆ x_max

types::Feature ppforest2::viz::BoundaryVisitor::x_max

◆ x_min

types::Feature ppforest2::viz::BoundaryVisitor::x_min

◆ y_max

types::Feature ppforest2::viz::BoundaryVisitor::y_max

Visible bounding box.

◆ y_min

types::Feature ppforest2::viz::BoundaryVisitor::y_min

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