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

Composite stop rule that fires when any child rule fires (logical OR). More...

#include <CompositeStop.hpp>

Public Member Functions

 CompositeStop (std::vector< StopRule::Ptr > rules)
 
std::string display_name () const override
 Human-readable name for display in summaries.
 
std::set< types::Modesupported_modes () const override
 Supported modes = intersection of child rules' supported modes.
 
nlohmann::json to_json () const override
 Serialize this strategy's configuration to JSON.
 
- Public Member Functions inherited from ppforest2::stop::StopRule
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
 

Static Public Member Functions

static StopRule::Ptr from_json (nlohmann::json const &j)
 
- 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.
 

Public Attributes

std::vector< StopRule::Ptrrules
 

Protected Member Functions

bool compute (NodeContext const &ctx, stats::RNG &rng) const override
 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
 

Detailed Description

Composite stop rule that fires when any child rule fires (logical OR).

Useful for combining multiple stopping criteria, e.g.:

StopRule::Ptr min_variance(types::Feature threshold)
Factory function for minimum-variance stop rule.
StopRule::Ptr any(std::vector< StopRule::Ptr > rules)
Factory function for composite stop rule (logical OR).
StopRule::Ptr min_size(int n)
Factory function for minimum-size stop rule.

Constructor & Destructor Documentation

◆ CompositeStop()

ppforest2::stop::CompositeStop::CompositeStop ( std::vector< StopRule::Ptr > rules)
explicit

Member Function Documentation

◆ compute()

bool ppforest2::stop::CompositeStop::compute ( NodeContext const & ctx,
stats::RNG & rng ) const
overrideprotectedvirtual

Subclass implementation of the stop predicate.

Implements ppforest2::stop::StopRule.

◆ display_name()

std::string ppforest2::stop::CompositeStop::display_name ( ) const
overridevirtual

Human-readable name for display in summaries.

Implements Strategy< StopRule >.

◆ from_json()

static StopRule::Ptr ppforest2::stop::CompositeStop::from_json ( nlohmann::json const & j)
static

◆ supported_modes()

std::set< types::Mode > ppforest2::stop::CompositeStop::supported_modes ( ) const
overridevirtual

Supported modes = intersection of child rules' supported modes.

A composite stop rule is only usable in a mode where every child rule is usable. E.g. any(pure_node, min_size) supports only classification (pure_node restricts it).

Implements Strategy< StopRule >.

◆ to_json()

nlohmann::json ppforest2::stop::CompositeStop::to_json ( ) const
overridevirtual

Serialize this strategy's configuration to JSON.

Must include a "name" field identifying the strategy type, plus any strategy-specific parameters.

Implements Strategy< StopRule >.

Member Data Documentation

◆ rules

std::vector<StopRule::Ptr> ppforest2::stop::CompositeStop::rules

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