ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::stop::StopRule Class Referenceabstract

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::Modesupported_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.
 

Detailed Description

Abstract strategy for tree stopping rules.

Returns true when the node should become a leaf. Does not write to the context.

Member Function Documentation

◆ compute()

virtual bool ppforest2::stop::StopRule::compute ( NodeContext const & ctx,
stats::RNG & rng ) const
protectedpure virtual

◆ should_stop()

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.


The documentation for this class was generated from the following file: