|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Abstract strategy for managing group partitions. More...
#include <Grouping.hpp>
Public Member Functions | |
| stats::GroupPartition | init (types::GroupIdVector const &y) const |
Convenience overload for callers with a GroupIdVector. | |
| stats::GroupPartition | init (types::OutcomeVector const &y) const |
| Create the initial GroupPartition from the training response. | |
| void | split (NodeContext &ctx, stats::RNG &rng) const |
| Split observations into two child partitions; writes ctx.lower_y_part / upper_y_part. | |
Public Member Functions inherited from Strategy< Grouping > | |
| virtual | ~Strategy ()=default |
| virtual std::string | display_name () const=0 |
| Human-readable name for display in summaries. | |
| virtual std::set< ppforest2::types::Mode > | supported_modes () const=0 |
| Training modes this strategy supports. | |
| virtual nlohmann::json | to_json () const=0 |
| Serialize this strategy's configuration to JSON. | |
Protected Member Functions | |
| virtual void | compute (NodeContext &ctx, stats::RNG &rng) const =0 |
| Subclass implementation of per-node splitting. | |
| virtual stats::GroupPartition | compute_init (types::OutcomeVector const &y) const =0 |
| Subclass implementation of initial partition construction. | |
Additional Inherited Members | |
Public Types inherited from Strategy< Grouping > | |
| using | Factory |
| Factory function type for deserializing a strategy from JSON. | |
| using | Ptr |
Static Public Member Functions inherited from Strategy< Grouping > | |
| static Ptr | from_json (nlohmann::json const &j) |
| Construct a strategy from its JSON representation. | |
| static bool | register_strategy (std::string const &name, Factory factory) |
| Register a concrete strategy for JSON deserialization. | |
Abstract strategy for managing group partitions.
init() builds the root partition once before training; split() writes ctx.lower_y_part and ctx.upper_y_part per node.
|
protectedpure virtual |
Subclass implementation of per-node splitting.
Implemented in ppforest2::grouping::ByCutpoint, and ppforest2::grouping::ByLabel.
|
protectedpure virtual |
Subclass implementation of initial partition construction.
Implemented in ppforest2::grouping::ByCutpoint, and ppforest2::grouping::ByLabel.
|
inline |
Convenience overload for callers with a GroupIdVector.
| stats::GroupPartition ppforest2::grouping::Grouping::init | ( | types::OutcomeVector const & | y | ) | const |
Create the initial GroupPartition from the training response.
Caller must pre-sort rows so equal values (classification) or ascending response (regression) form contiguous blocks.
Public NVI entry point: delegates to the subclass-provided compute_init, then asserts the partition's post-conditions — blocks rooted at row 0 and covering all of y. Downstream callers (e.g. stratified resampling in ClassificationForest::train_tree) rely on those properties to safely reuse the parent partition over a resampled response.
| void ppforest2::grouping::Grouping::split | ( | NodeContext & | ctx, |
| stats::RNG & | rng ) const |
Split observations into two child partitions; writes ctx.lower_y_part / upper_y_part.
Public NVI entry point: skips if ctx.aborted is set, otherwise delegates to the subclass-provided compute.