ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
LeafStrategy.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "models/TreeNode.hpp"
5#include "stats/Stats.hpp"
6
7namespace ppforest2 {
8 struct NodeContext;
9}
10
20namespace ppforest2::leaf {
26 class LeafStrategy : public Strategy<LeafStrategy> {
27 public:
33 TreeNode::Ptr create_leaf(NodeContext const& ctx, stats::RNG& rng) const { return compute(ctx, rng); }
34
35 protected:
37 virtual TreeNode::Ptr compute(NodeContext const& ctx, stats::RNG& rng) const = 0;
38 };
39
42
45}
CRTP base class providing self-registration for strategy types.
Definition Strategy.hpp:93
std::shared_ptr< LeafStrategy > Ptr
Definition Strategy.hpp:95
std::unique_ptr< TreeNode > Ptr
Definition TreeNode.hpp:21
Abstract strategy for creating leaf nodes.
Definition LeafStrategy.hpp:26
TreeNode::Ptr create_leaf(NodeContext const &ctx, stats::RNG &rng) const
Create a leaf node for the given node context.
Definition LeafStrategy.hpp:33
virtual TreeNode::Ptr compute(NodeContext const &ctx, stats::RNG &rng) const =0
Subclass implementation of leaf construction.
Leaf creation strategies.
Definition LeafStrategy.hpp:20
LeafStrategy::Ptr majority_vote()
Factory function for majority-vote leaf strategy.
LeafStrategy::Ptr mean_response()
Factory function for mean-response leaf strategy.
pcg32 RNG
Definition Stats.hpp:24
Binarization strategies for multiclass-to-binary reduction.
Definition Benchmark.hpp:25
Mutable context accumulating intermediate results during node training.
Definition NodeContext.hpp:20