ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
MockStop.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <nlohmann/json.hpp>
6
7#include <set>
8#include <string>
9
10namespace ppforest2::test {
19 class MockStop : public stop::StopRule {
20 public:
22 mutable int compute_calls = 0;
23
24 explicit MockStop(bool compute_return = false)
26
27 nlohmann::json to_json() const override { return {{"name", "mock_stop"}}; }
28 std::string display_name() const override { return "Mock Stop"; }
29 std::set<types::Mode> supported_modes() const override {
31 }
32
33 protected:
34 bool compute(NodeContext const& /*ctx*/, stats::RNG& /*rng*/) const override {
36 return compute_return;
37 }
38 };
39}
Abstract strategy for tree stopping rules.
Definition StopRule.hpp:26
bool compute(NodeContext const &, stats::RNG &) const override
Subclass implementation of the stop predicate.
Definition MockStop.hpp:34
bool compute_return
Definition MockStop.hpp:21
int compute_calls
Definition MockStop.hpp:22
nlohmann::json to_json() const override
Serialize this strategy's configuration to JSON.
Definition MockStop.hpp:27
std::string display_name() const override
Human-readable name for display in summaries.
Definition MockStop.hpp:28
std::set< types::Mode > supported_modes() const override
Training modes this strategy supports.
Definition MockStop.hpp:29
MockStop(bool compute_return=false)
Definition MockStop.hpp:24
pcg32 RNG
Definition Stats.hpp:24
Definition MockStop.hpp:10
@ Classification
Definition Types.hpp:58
@ Regression
Definition Types.hpp:58
Mutable context accumulating intermediate results during node training.
Definition NodeContext.hpp:20