|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Visitor that collects convex decision region polygons. More...
#include <Visualization.hpp>
Public Member Functions | |
| RegionVisitor (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< HalfSpace > | constraints |
| Accumulated ancestor constraints. | |
| std::vector< std::pair< int, types::Feature > > | fixed_vars |
| Fixed (index, value) pairs. | |
| std::vector< RegionPolygon > | regions |
| Output: one polygon per reachable leaf. | |
| 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 |
| Bounding box for the initial rectangle. | |
| types::Feature | y_min |
Visitor that collects convex decision region polygons.
At each leaf, starts with the full bounding box as a rectangle and clips it against every ancestor split's half-space constraint (projected to 2D via project_2d / adjust_threshold). The result is a convex polygon representing the leaf's decision region in the (var_i, var_j) plane.
Uses the Sutherland–Hodgman algorithm (clip_polygon_halfspace) for each constraint. If the polygon becomes empty (leaf unreachable in the 2D slice), it is silently skipped.
Usage:
| ppforest2::viz::RegionVisitor::RegionVisitor | ( | 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 ) |
|
overridevirtual |
Implements ppforest2::TreeNode::Visitor.
|
overridevirtual |
Implements ppforest2::TreeNode::Visitor.
| std::vector<HalfSpace> ppforest2::viz::RegionVisitor::constraints |
Accumulated ancestor constraints.
| std::vector<std::pair<int, types::Feature> > ppforest2::viz::RegionVisitor::fixed_vars |
Fixed (index, value) pairs.
| std::vector<RegionPolygon> ppforest2::viz::RegionVisitor::regions |
Output: one polygon per reachable leaf.
| int ppforest2::viz::RegionVisitor::var_i |
| int ppforest2::viz::RegionVisitor::var_j |
Indices of the two displayed feature variables.
| types::Feature ppforest2::viz::RegionVisitor::x_max |
| types::Feature ppforest2::viz::RegionVisitor::x_min |
| types::Feature ppforest2::viz::RegionVisitor::y_max |
Bounding box for the initial rectangle.
| types::Feature ppforest2::viz::RegionVisitor::y_min |