|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Namespaces | |
| namespace | cli |
| Command-line interface: argument parsing, subcommands, and benchmark/evaluation orchestration. | |
| namespace | dr |
| Dimensionality reduction strategies for variable selection. | |
| namespace | io |
| namespace | math |
| Numeric comparison utilities. | |
| namespace | pp |
| Projection pursuit strategies. | |
| namespace | serialization |
| JSON serialization and deserialization for ppforest2 models. | |
| namespace | sr |
| Split rule strategies for computing decision thresholds. | |
| namespace | stats |
| Statistical infrastructure for training and evaluation. | |
| namespace | sys |
| System-level utilities (process memory measurement). | |
| namespace | types |
| Core numeric type aliases for the ppforest2 library. | |
| namespace | utils |
| Utility functions for std::map manipulation. | |
| namespace | viz |
Classes | |
| struct | BootstrapTree |
| struct | Forest |
| A projection pursuit random forest. More... | |
| struct | Model |
| Abstract base class for predictive models (trees and forests). More... | |
| struct | Proportions |
| Tag type for requesting vote-proportion predictions. More... | |
| struct | TrainingSpec |
| Training configuration for projection pursuit trees and forests. More... | |
| struct | Tree |
| A single projection pursuit decision tree. More... | |
| struct | TreeCondition |
| Internal split node in a projection pursuit tree. More... | |
| struct | TreeNode |
| Abstract base class for nodes in a projection pursuit tree. More... | |
| struct | TreeResponse |
| Leaf node in a projection pursuit tree. More... | |
| class | UserError |
| Exception for user-facing input validation errors. More... | |
| struct | VariableImportance |
| Grouped result of the three variable importance measures. More... | |
| struct | VIVisitor |
| Visitor that accumulates per-variable contributions for VI2 and VI3. More... | |
Typedefs | |
| using | Threshold = types::Feature |
| Scalar threshold type for split decisions. | |
Functions | |
| void | user_error (bool condition, char const *message) |
| Throw a UserError if the condition is false. | |
| void | user_error (bool condition, std::string const &message) |
| Throw a UserError if the condition is false. | |
| void | validate_json_keys (nlohmann::json const &j, std::string const &context, std::initializer_list< std::string > allowed) |
| Validate that a JSON object contains only expected keys. | |
| types::FeatureVector | variable_importance_permuted (Forest const &forest, types::FeatureMatrix const &x, types::ResponseVector const &y, int seed=0) |
| VI1 — Permuted importance. | |
| types::FeatureVector | variable_importance_projections (Forest const &forest, int n_vars, types::FeatureVector const *scale=nullptr) |
| VI2 — Projections importance (forest). | |
| types::FeatureVector | variable_importance_projections (Tree const &tree, int n_vars, types::FeatureVector const *scale=nullptr) |
| VI2 — Projections importance (single tree). | |
| types::FeatureVector | variable_importance_weighted_projections (Forest const &forest, types::FeatureMatrix const &x, types::ResponseVector const &y, types::FeatureVector const *scale=nullptr) |
| VI3 — Weighted projections importance. | |
| using ppforest2::Threshold = types::Feature |
Scalar threshold type for split decisions.
| void ppforest2::user_error | ( | bool | condition, |
| char const * | message ) |
Throw a UserError if the condition is false.
| condition | Condition that must hold for valid input. |
| message | Actionable error message for the user. |
| void ppforest2::user_error | ( | bool | condition, |
| std::string const & | message ) |
Throw a UserError if the condition is false.
| condition | Condition that must hold for valid input. |
| message | Actionable error message for the user. |
|
inline |
Validate that a JSON object contains only expected keys.
| j | The JSON object to check. |
| context | Human-readable strategy description (e.g. "PDA"). |
| allowed | Set of allowed key names. |
| std::runtime_error | if an unknown key is found. |
| types::FeatureVector ppforest2::variable_importance_permuted | ( | Forest const & | forest, |
| types::FeatureMatrix const & | x, | ||
| types::ResponseVector const & | y, | ||
| int | seed = 0 ) |
VI1 — Permuted importance.
For each tree, measures the drop in OOB accuracy when each variable is randomly permuted among the OOB observations. Results are averaged over all trees.
| forest | Trained random forest. |
| x | Training feature matrix (n × p). |
| y | Training response vector (n). |
| seed | RNG seed for the permutations. |
| types::FeatureVector ppforest2::variable_importance_projections | ( | Forest const & | forest, |
| int | n_vars, | ||
| types::FeatureVector const * | scale = nullptr ) |
VI2 — Projections importance (forest).
At every split node s with G_s groups, accumulates |a_j| / G_s for each variable j. When scale is provided each |a_j| is first multiplied by σ_j so that coefficients are comparable across variables with different units. Results are averaged over all trees.
| forest | Trained random forest. |
| n_vars | Number of predictor variables (p). |
| scale | Optional per-variable σ vector (size p). |
| types::FeatureVector ppforest2::variable_importance_projections | ( | Tree const & | tree, |
| int | n_vars, | ||
| types::FeatureVector const * | scale = nullptr ) |
VI2 — Projections importance (single tree).
Same as the forest overload but for a single tree (no averaging).
| tree | Trained tree. |
| n_vars | Number of predictor variables (p). |
| scale | Optional per-variable σ vector (size p). |
| types::FeatureVector ppforest2::variable_importance_weighted_projections | ( | Forest const & | forest, |
| types::FeatureMatrix const & | x, | ||
| types::ResponseVector const & | y, | ||
| types::FeatureVector const * | scale = nullptr ) |
VI3 — Weighted projections importance.
Each tree's contribution is weighted by (1 − e_k), where e_k is its OOB error rate, and each split node contributes I_s × |a_j|. The result is normalised by B × (G − 1).
| forest | Trained random forest. |
| x | Training feature matrix (n × p). |
| y | Training response vector (n). |
| scale | Optional per-variable σ vector (size p). |