|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
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< HalfSpace > | constraints |
| 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 |
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.
| 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 ) |
|
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.
|
overridevirtual |
No-op default; override in subclasses that need leaf work.
Reimplemented from ppforest2::TreeNode::Visitor.
| std::vector<HalfSpace> ppforest2::viz::SpatialVisitor::constraints |
Accumulated ancestor half-space constraints.
| int ppforest2::viz::SpatialVisitor::depth |
| std::vector<std::pair<int, types::Feature> > ppforest2::viz::SpatialVisitor::fixed_vars |
Fixed (index, value) pairs.
| int ppforest2::viz::SpatialVisitor::var_i |
| int ppforest2::viz::SpatialVisitor::var_j |
Indices of the two displayed feature variables.
| types::Feature ppforest2::viz::SpatialVisitor::x_max |
| types::Feature ppforest2::viz::SpatialVisitor::x_min |
| types::Feature ppforest2::viz::SpatialVisitor::y_max |
Visible bounding box.
| types::Feature ppforest2::viz::SpatialVisitor::y_min |