|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Abstract strategy for tree stopping rules. More...
#include <StopRule.hpp>
Public Member Functions | |
| bool | should_stop (NodeContext const &ctx, stats::RNG &rng) const |
| Determine whether to stop growing at this node. | |
Public Member Functions inherited from Strategy< StopRule > | |
| 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 bool | compute (NodeContext const &ctx, stats::RNG &rng) const =0 |
| Subclass implementation of the stop predicate. | |
Additional Inherited Members | |
Public Types inherited from Strategy< StopRule > | |
| using | Factory |
| Factory function type for deserializing a strategy from JSON. | |
| using | Ptr |
Static Public Member Functions inherited from Strategy< StopRule > | |
| 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 tree stopping rules.
Returns true when the node should become a leaf. Does not write to the context.
|
protectedpure virtual |
Subclass implementation of the stop predicate.
Implemented in ppforest2::stop::CompositeStop, ppforest2::stop::MaxDepth, ppforest2::stop::MinSize, ppforest2::stop::MinVariance, ppforest2::stop::PureNode, and ppforest2::test::MockStop.
| bool ppforest2::stop::StopRule::should_stop | ( | NodeContext const & | ctx, |
| stats::RNG & | rng ) const |
Determine whether to stop growing at this node.
Public NVI entry point. Returns true if the configured stop rule fires, OR if the node has fewer than 2 groups (a tree-level invariant — no grouping strategy can split a single group, so stopping is the only sane option). Otherwise delegates to the subclass-provided compute.