ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
MajorityVote.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace ppforest2::leaf {
15 class MajorityVote : public LeafStrategy {
16 public:
17 static LeafStrategy::Ptr from_json(nlohmann::json const& j);
18
19 nlohmann::json to_json() const override;
20 std::string display_name() const override { return "Majority vote"; }
21 std::set<types::Mode> supported_modes() const override { return {types::Mode::Classification}; }
22
24
25 protected:
29 TreeNode::Ptr compute(NodeContext const& ctx, stats::RNG& rng) const override;
30 };
31}
#define PPFOREST2_REGISTER_STRATEGY(StrategyBase, name)
Auto-registration macro for strategy factories.
Definition Strategy.hpp:185
std::shared_ptr< LeafStrategy > Ptr
Definition Strategy.hpp:95
Abstract base class for nodes in a projection pursuit tree.
Definition TreeNode.hpp:19
Abstract strategy for creating leaf nodes.
Definition LeafStrategy.hpp:26
Leaf creation by majority vote.
Definition MajorityVote.hpp:15
static LeafStrategy::Ptr from_json(nlohmann::json const &j)
std::string display_name() const override
Human-readable name for display in summaries.
Definition MajorityVote.hpp:20
std::set< types::Mode > supported_modes() const override
Training modes this strategy supports.
Definition MajorityVote.hpp:21
nlohmann::json to_json() const override
Serialize this strategy's configuration to JSON.
TreeNode::Ptr compute(NodeContext const &ctx, stats::RNG &rng) const override
Create a majority-vote leaf from the node's group partition.
Leaf creation strategies.
Definition LeafStrategy.hpp:20
Statistical infrastructure for training and evaluation.
Definition ConfusionMatrix.hpp:11
@ Classification
Definition Types.hpp:58
Mutable context accumulating intermediate results during node training.
Definition NodeContext.hpp:20