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

Leaf creation by mean response value. More...

#include <MeanResponse.hpp>

Public Member Functions

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::leaf::LeafStrategy
TreeNode::Ptr create_leaf (NodeContext const &ctx, stats::RNG &rng) const
 Create a leaf node for the given node context.
 
- Public Member Functions inherited from Strategy< LeafStrategy >
virtual ~Strategy ()=default
 

Static Public Member Functions

static LeafStrategy::Ptr from_json (nlohmann::json const &j)
 
- Static Public Member Functions inherited from Strategy< LeafStrategy >
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.
 

Protected Member Functions

TreeNode::Ptr compute (NodeContext const &ctx, stats::RNG &rng) const override
 Create a mean-response leaf from the node's observations.
 

Additional Inherited Members

- Public Types inherited from Strategy< LeafStrategy >
using Factory
 Factory function type for deserializing a strategy from JSON.
 
using Ptr
 

Detailed Description

Leaf creation by mean response value.

Returns a TreeLeaf whose value is the mean of the continuous response for observations in this node. Used for regression trees.

Requires NodeContext::y_vec to be set (populated by the training pipeline for regression; null for classification).

Member Function Documentation

◆ compute()

TreeNode::Ptr ppforest2::leaf::MeanResponse::compute ( NodeContext const & ctx,
stats::RNG & rng ) const
overrideprotectedvirtual

Create a mean-response leaf from the node's observations.

Implements ppforest2::leaf::LeafStrategy.

◆ display_name()

std::string ppforest2::leaf::MeanResponse::display_name ( ) const
inlineoverridevirtual

Human-readable name for display in summaries.

Implements Strategy< LeafStrategy >.

◆ from_json()

static LeafStrategy::Ptr ppforest2::leaf::MeanResponse::from_json ( nlohmann::json const & j)
static

◆ supported_modes()

std::set< types::Mode > ppforest2::leaf::MeanResponse::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< LeafStrategy >.

◆ to_json()

nlohmann::json ppforest2::leaf::MeanResponse::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< LeafStrategy >.


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