|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Command-line interface: argument parsing, subcommands, and benchmark/evaluation orchestration. More...
Namespaces | |
| namespace | serve |
Classes | |
| struct | Baseline |
| A baseline suite with a pre-built name → result index. More... | |
| struct | BenchmarkParams |
| Benchmark-specific options. More... | |
| struct | BenchmarkReport |
| Benchmark report with comparison, display, and export. More... | |
| struct | BenchmarkSuite |
| A suite of scenarios with shared defaults. More... | |
| struct | EvaluateParams |
| Evaluate and convergence options (shared by evaluate + benchmark). More... | |
| struct | ModelParams |
| Model training parameters shared by train and evaluate. More... | |
| struct | Params |
| All CLI options and runtime parameters. More... | |
| struct | ScenarioResult |
| Result of running a single benchmark scenario. More... | |
| struct | ServeParams |
serve subcommand options. CLI-exclusive; no config file roundtrip. More... | |
| struct | SimulateParams |
| Simulation data source options. More... | |
| struct | SuiteResult |
| Aggregated results for an entire suite run. More... | |
| struct | TrainResult |
| Result of a train operation containing the model and training duration. More... | |
Enumerations | |
| enum class | Subcommand : uint8_t { none , train , predict , evaluate , benchmark , summarize , serve } |
| Available CLI subcommands. More... | |
Functions | |
| void | add_evaluate_options (CLI::App *sub, EvaluateParams &evaluate) |
| Add evaluate/convergence options shared by evaluate and benchmark. | |
| void | add_model_options (CLI::App *sub, ModelParams &model) |
Add shared model options (size, lambda, threads, seed, vars) to sub. | |
| void | check (bool condition, std::string const &message, std::vector< std::string > &errors) |
| Collects validation errors grouped by label. | |
| Params | parse_args (int argc, char *argv[]) |
| Parse command-line arguments into a Params struct. | |
| float | parse_proportion (nlohmann::json const &j) |
| float | parse_proportion (std::string const &input) |
| Parse a proportion from a string or JSON value. | |
| BenchmarkSuite | parse_suite (nlohmann::json const &j) |
| Parse a BenchmarkSuite from a JSON object. | |
| BenchmarkSuite | parse_suite (std::string const &path) |
| Parse a BenchmarkSuite from a JSON file path. | |
| int | run_benchmark (Params const ¶ms, std::string const &binary_path) |
| Run the benchmark subcommand. | |
| int | run_evaluate (Params ¶ms) |
| Run the evaluate subcommand. | |
| int | run_predict (Params const ¶ms) |
| Run the predict subcommand. | |
| ScenarioResult | run_scenario (nlohmann::json const &scenario, std::string const &binary_path) |
| Run a single scenario as a subprocess. | |
| int | run_serve (Params const ¶ms) |
| Run the serve subcommand. | |
| SuiteResult | run_suite (BenchmarkSuite const &suite, std::string const &binary_path, io::Output &out) |
| Run all scenarios in a suite via subprocess invocations. | |
| int | run_summarize (Params ¶ms) |
| Run the summarize subcommand. | |
| int | run_train (Params ¶ms) |
| Run the train subcommand. | |
| void | setup_benchmark (CLI::App &app, Params ¶ms) |
Register benchmark subcommand options on app. | |
| void | setup_evaluate (CLI::App &app, Params ¶ms) |
Register evaluate subcommand options on app. | |
| void | setup_predict (CLI::App &app, Params ¶ms) |
Register predict subcommand options on app. | |
| void | setup_serve (CLI::App &app, Params ¶ms) |
Register serve subcommand options on app. | |
| void | setup_summarize (CLI::App &app, Params ¶ms) |
Register summarize subcommand options on app. | |
| void | setup_train (CLI::App &app, Params ¶ms) |
Register train subcommand options on app. | |
| nlohmann::json | strategy_string_to_json (std::string const &input) |
| Parse a CLI strategy string into a JSON object. | |
| TrainResult | train_model (ppforest2::types::FeatureMatrix const &x, ppforest2::types::OutcomeVector const &y, Params const ¶ms) |
| Train a single model (Forest or Tree) on the given dataset. | |
| nlohmann::json | training_defaults () |
| Default values for shared training parameters. | |
| void | validate_params (Params const ¶ms) |
| Validate training-related params and throw on errors. | |
| void | validate_training_config (nlohmann::json const &config, std::vector< std::string > &errors) |
| Validate a training config JSON. | |
| void | warn_unused_params (io::Output &out, Params const ¶ms) |
| Warn the user about parameters that are ignored for single-tree training. | |
Command-line interface: argument parsing, subcommands, and benchmark/evaluation orchestration.
|
strong |
Available CLI subcommands.
| Enumerator | |
|---|---|
| none | |
| train | |
| predict | |
| evaluate | |
| benchmark | |
| summarize | |
| serve | |
| void ppforest2::cli::add_evaluate_options | ( | CLI::App * | sub, |
| EvaluateParams & | evaluate ) |
Add evaluate/convergence options shared by evaluate and benchmark.
| void ppforest2::cli::add_model_options | ( | CLI::App * | sub, |
| ModelParams & | model ) |
Add shared model options (size, lambda, threads, seed, vars) to sub.
|
inline |
Collects validation errors grouped by label.
Use begin() to start a new group (e.g., a scenario name), then pass errors() to validation functions that append to a std::vector<std::string>&.
Append an error message if condition is false.
| Params ppforest2::cli::parse_args | ( | int | argc, |
| char * | argv[] ) |
| float ppforest2::cli::parse_proportion | ( | nlohmann::json const & | j | ) |
| float ppforest2::cli::parse_proportion | ( | std::string const & | input | ) |
Parse a proportion from a string or JSON value.
Formats:
| UserError | on invalid input. |
| BenchmarkSuite ppforest2::cli::parse_suite | ( | nlohmann::json const & | j | ) |
Parse a BenchmarkSuite from a JSON object.
| UserError | on validation errors. |
| BenchmarkSuite ppforest2::cli::parse_suite | ( | std::string const & | path | ) |
Parse a BenchmarkSuite from a JSON file path.
| UserError | on parse or validation errors. |
| int ppforest2::cli::run_benchmark | ( | Params const & | params, |
| std::string const & | binary_path ) |
| int ppforest2::cli::run_evaluate | ( | Params & | params | ) |
Run the evaluate subcommand.
| int ppforest2::cli::run_predict | ( | Params const & | params | ) |
Run the predict subcommand.
| ScenarioResult ppforest2::cli::run_scenario | ( | nlohmann::json const & | scenario, |
| std::string const & | binary_path ) |
Run a single scenario as a subprocess.
| int ppforest2::cli::run_serve | ( | Params const & | params | ) |
Run the serve subcommand.
| SuiteResult ppforest2::cli::run_suite | ( | BenchmarkSuite const & | suite, |
| std::string const & | binary_path, | ||
| io::Output & | out ) |
Run all scenarios in a suite via subprocess invocations.
For each scenario, spawns ppforest2 evaluate as a child process with the appropriate flags, reads its JSON output, and collects results. Progress is printed to out.
| suite | The benchmark suite to run. |
| binary_path | Path to the ppforest2 binary (typically argv[0]). |
| out | Output context for progress reporting. |
| int ppforest2::cli::run_summarize | ( | Params & | params | ) |
Run the summarize subcommand.
| int ppforest2::cli::run_train | ( | Params & | params | ) |
Run the train subcommand.
| void ppforest2::cli::setup_benchmark | ( | CLI::App & | app, |
| Params & | params ) |
Register benchmark subcommand options on app.
| void ppforest2::cli::setup_evaluate | ( | CLI::App & | app, |
| Params & | params ) |
Register evaluate subcommand options on app.
| void ppforest2::cli::setup_predict | ( | CLI::App & | app, |
| Params & | params ) |
Register predict subcommand options on app.
| void ppforest2::cli::setup_serve | ( | CLI::App & | app, |
| Params & | params ) |
Register serve subcommand options on app.
| void ppforest2::cli::setup_summarize | ( | CLI::App & | app, |
| Params & | params ) |
Register summarize subcommand options on app.
| void ppforest2::cli::setup_train | ( | CLI::App & | app, |
| Params & | params ) |
Register train subcommand options on app.
| nlohmann::json ppforest2::cli::strategy_string_to_json | ( | std::string const & | input | ) |
Parse a CLI strategy string into a JSON object.
Converts e.g. "pda:lambda=0.3" to {"name": "pda", "lambda": 0.3}.
| TrainResult ppforest2::cli::train_model | ( | ppforest2::types::FeatureMatrix const & | x, |
| ppforest2::types::OutcomeVector const & | y, | ||
| Params const & | params ) |
Train a single model (Forest or Tree) on the given dataset.
Takes x / y by const ref and copies internally — regression training (ByCutpoint) permutes rows in place via std::stable_sort, which would leak across calls if we passed the caller's matrix straight through. Centralising the copy here keeps the mutation contract internal and lets callers (warmup loops, multi-iteration evaluate, etc.) reuse the same input across calls without per-call boilerplate.
| nlohmann::json ppforest2::cli::training_defaults | ( | ) |
Default values for shared training parameters.
Used by train and evaluate to fill in unset fields before validation. Benchmark does not apply these — its scenarios must be explicit.
| void ppforest2::cli::validate_params | ( | Params const & | params | ) |
Validate training-related params and throw on errors.
Builds a config from params, validates it, and throws UserError with all collected messages if any checks fail.
| void ppforest2::cli::validate_training_config | ( | nlohmann::json const & | config, |
| std::vector< std::string > & | errors ) |
Validate a training config JSON.
Checks all required fields, ranges, and mutual exclusions. Appends error messages to errors (empty if valid).
| config | The config to validate. |
| errors | Output vector to accumulate error messages. |
| void ppforest2::cli::warn_unused_params | ( | io::Output & | out, |
| Params const & | params ) |
Warn the user about parameters that are ignored for single-tree training.