ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
EvaluateParams.hpp
Go to the documentation of this file.
1
5#pragma once
6
8
9#include <nlohmann/json.hpp>
10#include <optional>
11#include <string>
12#include <vector>
13
14namespace ppforest2::cli {
17 SimulateParams() = default;
18
19 std::string format;
20 int rows = 1000;
21 int cols = 10;
22 int n_groups = 2;
23
26
28 explicit SimulateParams(nlohmann::json const& config);
29
32
42 };
43
46 EvaluateParams() = default;
47
48 std::optional<float> train_ratio;
49 std::optional<int> iterations;
50 int warmup = 0;
64 bool fixed_seed = false;
65 std::string export_path;
66
68 bool convergence_enabled() const { return !iterations || *iterations <= 0; }
69
71 struct Convergence {
72 std::optional<float> cv;
73 std::optional<int> min;
74 std::optional<int> window;
75 std::optional<int> max;
77
79 static void validate(nlohmann::json const& config, std::vector<std::string>& errors);
80
82 explicit EvaluateParams(nlohmann::json const& config);
83
86
88 nlohmann::json to_json() const;
89
91 nlohmann::json overrides() const;
92 };
93}
Command-line interface: argument parsing, subcommands, and benchmark/evaluation orchestration.
Definition Benchmark.hpp:25
pcg32 RNG
Definition Stats.hpp:24
Mode
Training mode.
Definition Types.hpp:58
Convergence control.
Definition EvaluateParams.hpp:71
std::optional< int > max
Hard upper bound on iterations.
Definition EvaluateParams.hpp:75
std::optional< int > min
Minimum iterations before checking convergence.
Definition EvaluateParams.hpp:73
std::optional< int > window
Consecutive checks below threshold before stopping.
Definition EvaluateParams.hpp:74
std::optional< float > cv
CV target (e.g. 0.05 = stop when std < 5% of mean).
Definition EvaluateParams.hpp:72
bool fixed_seed
Use the user-provided seed unchanged for every iteration.
Definition EvaluateParams.hpp:64
void resolve_defaults()
Fill unset optional fields with their default values.
EvaluateParams(nlohmann::json const &config)
Construct from a JSON config object.
std::string export_path
Definition EvaluateParams.hpp:65
std::optional< float > train_ratio
Definition EvaluateParams.hpp:48
std::optional< int > iterations
Fixed count (disables convergence when set > 0).
Definition EvaluateParams.hpp:49
bool convergence_enabled() const
Whether adaptive convergence stopping is active (disabled when iterations is set).
Definition EvaluateParams.hpp:68
nlohmann::json to_json() const
Serialize to JSON config.
static void validate(nlohmann::json const &config, std::vector< std::string > &errors)
Validate evaluate-related fields in a JSON config.
struct ppforest2::cli::EvaluateParams::Convergence convergence
int warmup
Warmup iterations discarded before measuring.
Definition EvaluateParams.hpp:50
nlohmann::json overrides() const
JSON with only the fields explicitly set (for scenario overrides).
stats::DataPacket simulate(types::Mode mode, stats::RNG &rng) const
Generate a simulated dataset for the given mode.
int cols
Definition EvaluateParams.hpp:21
int rows
Definition EvaluateParams.hpp:20
stats::simulation::params::Classification classification
Definition EvaluateParams.hpp:24
int n_groups
Definition EvaluateParams.hpp:22
stats::simulation::params::Regression regression
Definition EvaluateParams.hpp:25
void resolve_format()
Parse the NxPxG format string into rows, cols, n_groups.
std::string format
Definition EvaluateParams.hpp:19
SimulateParams(nlohmann::json const &config)
Construct from a JSON config object.
Bundled dataset: features, response, and group labels.
Definition DataPacket.hpp:19
Classification simulation: group-shifted normals.
Definition Simulation.hpp:17
Regression simulation: linear model over i.i.d. features.
Definition Simulation.hpp:31