|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Visitor that accumulates per-variable contributions for VI2 and VI3. More...
#include <VIVisitor.hpp>
Public Member Functions | |
| VIVisitor (int n_vars, types::FeatureVector const *scale=nullptr) | |
Construct a visitor for a tree with n_vars variables. | |
| void | visit (TreeCondition const &node) override |
| Visit a split node; accumulate contributions and recurse. | |
| void | visit (TreeResponse const &) override |
| Visit a leaf node; no contribution to VI. | |
Public Attributes | |
| types::FeatureVector const * | scale = nullptr |
| Optional per-variable σ vector (size p); scale[j] = σ_j. | |
| std::vector< types::Feature > | vi2_contributions |
| VI2 contributions per variable (size p). | |
| std::vector< types::Feature > | vi3_contributions |
| VI3 contributions per variable (size p). | |
Visitor that accumulates per-variable contributions for VI2 and VI3.
Traverses a single tree and, at each split node s with G_s groups and PP index I_s, accumulates:
vi2_contributions[j] += |a_j| / G_s vi3_contributions[j] += I_s * |a_j|
When scale is provided, each |a_j| is multiplied by σ_j so that coefficients are comparable across variables with different units.
The caller is responsible for forest-level aggregation and normalization described in Da Silva et al. (2021).
|
inlineexplicit |
Construct a visitor for a tree with n_vars variables.
| n_vars | Number of predictor variables (p). |
| scale | Optional per-variable σ vector (size p). |
|
inlineoverridevirtual |
Visit a split node; accumulate contributions and recurse.
| node | Split node with projector and pp_index_value. |
Implements ppforest2::TreeNode::Visitor.
|
inlineoverridevirtual |
Visit a leaf node; no contribution to VI.
Leaf nodes hold only a class label and do not contribute to variable importance.
Implements ppforest2::TreeNode::Visitor.
| types::FeatureVector const* ppforest2::VIVisitor::scale = nullptr |
Optional per-variable σ vector (size p); scale[j] = σ_j.
| std::vector<types::Feature> ppforest2::VIVisitor::vi2_contributions |
VI2 contributions per variable (size p).
| std::vector<types::Feature> ppforest2::VIVisitor::vi3_contributions |
VI3 contributions per variable (size p).