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
3
#include "
models/strategies/leaf/LeafStrategy.hpp
"
4
#include "
models/strategies/Strategy.hpp
"
5
6
namespace
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
23
PPFOREST2_REGISTER_STRATEGY
(
LeafStrategy
,
"majority_vote"
)
24
25
protected:
29
TreeNode
::
Ptr
compute
(
NodeContext
const& ctx,
stats
::RNG& rng) const override;
30
};
31
}
LeafStrategy.hpp
Strategy.hpp
PPFOREST2_REGISTER_STRATEGY
#define PPFOREST2_REGISTER_STRATEGY(StrategyBase, name)
Auto-registration macro for strategy factories.
Definition
Strategy.hpp:185
Strategy< LeafStrategy >::Ptr
std::shared_ptr< LeafStrategy > Ptr
Definition
Strategy.hpp:95
ppforest2::TreeNode
Abstract base class for nodes in a projection pursuit tree.
Definition
TreeNode.hpp:19
ppforest2::leaf::LeafStrategy
Abstract strategy for creating leaf nodes.
Definition
LeafStrategy.hpp:26
ppforest2::leaf::MajorityVote
Leaf creation by majority vote.
Definition
MajorityVote.hpp:15
ppforest2::leaf::MajorityVote::from_json
static LeafStrategy::Ptr from_json(nlohmann::json const &j)
ppforest2::leaf::MajorityVote::display_name
std::string display_name() const override
Human-readable name for display in summaries.
Definition
MajorityVote.hpp:20
ppforest2::leaf::MajorityVote::supported_modes
std::set< types::Mode > supported_modes() const override
Training modes this strategy supports.
Definition
MajorityVote.hpp:21
ppforest2::leaf::MajorityVote::to_json
nlohmann::json to_json() const override
Serialize this strategy's configuration to JSON.
ppforest2::leaf::MajorityVote::compute
TreeNode::Ptr compute(NodeContext const &ctx, stats::RNG &rng) const override
Create a majority-vote leaf from the node's group partition.
ppforest2::leaf
Leaf creation strategies.
Definition
LeafStrategy.hpp:20
ppforest2::stats
Statistical infrastructure for training and evaluation.
Definition
ConfusionMatrix.hpp:11
ppforest2::types::Mode::Classification
@ Classification
Definition
Types.hpp:58
ppforest2::NodeContext
Mutable context accumulating intermediate results during node training.
Definition
NodeContext.hpp:20
core
src
models
strategies
leaf
MajorityVote.hpp
Generated by
1.13.2