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

Mock StopRule whose verdict is fixed at construction time. More...

#include <MockStop.hpp>

Public Member Functions

 MockStop (bool compute_return=false)
 
std::string display_name () const override
 Human-readable name for display in summaries.
 
std::set< types::Modesupported_modes () const override
 Training modes this strategy supports.
 
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
 

Public Attributes

int compute_calls = 0
 
bool compute_return
 

Protected Member Functions

bool compute (NodeContext const &, stats::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
 
- 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

Mock StopRule whose verdict is fixed at construction time.

Decouples tests that exercise composition or NVI plumbing from any real stop rule. Carries a compute_calls counter so callers can assert how many times the inner compute was invoked — useful for verifying short-circuit semantics in CompositeStop.

Constructor & Destructor Documentation

◆ MockStop()

ppforest2::test::MockStop::MockStop ( bool compute_return = false)
inlineexplicit

Member Function Documentation

◆ compute()

bool ppforest2::test::MockStop::compute ( NodeContext const & ctx,
stats::RNG & rng ) const
inlineoverrideprotectedvirtual

Subclass implementation of the stop predicate.

Implements ppforest2::stop::StopRule.

◆ display_name()

std::string ppforest2::test::MockStop::display_name ( ) const
inlineoverridevirtual

Human-readable name for display in summaries.

Implements Strategy< StopRule >.

◆ supported_modes()

std::set< types::Mode > ppforest2::test::MockStop::supported_modes ( ) const
inlineoverridevirtual

Training modes this strategy supports.

Every concrete strategy MUST explicitly declare which modes it supports — there is no default. This forces implementers to think about mode compatibility rather than silently inheriting both modes and triggering runtime surprises.

Used by TrainingSpec to validate that every selected strategy is compatible with the configured training mode. Fails fast at build time instead of silently misbehaving at train time.

Implements Strategy< StopRule >.

◆ to_json()

nlohmann::json ppforest2::test::MockStop::to_json ( ) const
inlineoverridevirtual

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

◆ compute_calls

int ppforest2::test::MockStop::compute_calls = 0
mutable

◆ compute_return

bool ppforest2::test::MockStop::compute_return

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