ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
NodeContext.hpp
Go to the documentation of this file.
1#pragma once
2
6#include "utils/Types.hpp"
7
8#include <optional>
9
11
12namespace ppforest2 {
20 struct NodeContext {
33 int depth;
34
46 bool aborted = false;
47
56
58 std::optional<vars::VariableSelection::Result> var_selection;
59
61 std::optional<Projector> projector;
63 std::optional<types::Feature> pp_index_value;
64
71 std::optional<stats::GroupPartition> y_bin;
72
74 std::optional<types::Feature> cutpoint;
75
82 std::optional<types::GroupId> lower_group;
83 std::optional<types::GroupId> upper_group;
84
86 std::optional<stats::GroupPartition> lower_y_part;
87 std::optional<stats::GroupPartition> upper_y_part;
88
94
101 stats::GroupPartition const& active_partition() const { return y_bin.has_value() ? *y_bin : y; }
102 };
103}
ppforest2::pp::Projector Projector
Definition NodeContext.hpp:10
Contiguous-block representation of grouped observations.
Definition GroupPartition.hpp:40
types::FeatureVector Projector
Column vector of projection coefficients (one per variable).
Definition Projector.hpp:6
Eigen::Matrix< Feature, Eigen::Dynamic, Eigen::Dynamic > FeatureMatrix
Dynamic-size matrix of feature values.
Definition Types.hpp:33
Eigen::Matrix< Outcome, Eigen::Dynamic, 1 > OutcomeVector
Dynamic-size column vector of predictions.
Definition Types.hpp:42
Binarization strategies for multiclass-to-binary reduction.
Definition Benchmark.hpp:25
int depth
Depth of this node in the tree.
Definition NodeContext.hpp:33
stats::GroupPartition const & active_partition() const
Return the active group partition.
Definition NodeContext.hpp:101
stats::GroupPartition const & y
Original G-group partition for this node.
Definition NodeContext.hpp:31
types::FeatureMatrix & x
Full feature matrix.
Definition NodeContext.hpp:29
std::optional< types::Feature > cutpoint
Set by find_cutpoint: split cutpoint in projected space. std::nullopt before find_cutpoint runs.
Definition NodeContext.hpp:74
std::optional< vars::VariableSelection::Result > var_selection
Set by select_vars: variable selection result. std::nullopt before select_vars runs.
Definition NodeContext.hpp:58
std::optional< types::GroupId > upper_group
Definition NodeContext.hpp:83
std::optional< types::Feature > pp_index_value
Set by find_projection: projection pursuit index value achieved. std::nullopt before find_projection ...
Definition NodeContext.hpp:63
std::optional< stats::GroupPartition > y_bin
Set by regroup (multiclass → binary): 2-group binarized partition.
Definition NodeContext.hpp:71
std::optional< stats::GroupPartition > upper_y_part
Definition NodeContext.hpp:87
types::OutcomeVector & y_vec
Raw response vector whose row order matches x.
Definition NodeContext.hpp:55
std::optional< types::GroupId > lower_group
Set by find_cutpoint: labels of the two groups in active_partition(), oriented so lower_group's proje...
Definition NodeContext.hpp:82
std::optional< Projector > projector
Set by find_projection: optimized projector (full dimension, expanded). std::nullopt before find_proj...
Definition NodeContext.hpp:61
std::optional< stats::GroupPartition > lower_y_part
Set by group: child partitions routed to the lower / upper child nodes.
Definition NodeContext.hpp:86
NodeContext(types::FeatureMatrix &x, stats::GroupPartition const &y, types::OutcomeVector &y_vec, int depth)
Definition NodeContext.hpp:89
bool aborted
Sticky abort flag for the per-node strategy pipeline.
Definition NodeContext.hpp:46