|
ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
|
Pure request → response functions for the serve subcommand.
More...
#include "models/Model.hpp"#include "stats/Metrics.hpp"#include "utils/Types.hpp"#include <nlohmann/json.hpp>#include <cstddef>#include <deque>#include <map>#include <mutex>#include <optional>#include <string>#include <unordered_map>Go to the source code of this file.
Classes | |
| struct | ppforest2::cli::serve::LoadedModel |
| Immutable model snapshot captured once at server startup. More... | |
| struct | ppforest2::cli::serve::PredictionResult |
| Result of running a prediction request — kept around for the predictions store so the server can serve cached HTML on shareable URLs. More... | |
| class | ppforest2::cli::serve::PredictionStore |
| In-memory bounded store of recent prediction results, keyed by opaque IDs that survive a page refresh. Capacity-limited LRU; evicts the oldest entry once capacity is reached. More... | |
| struct | ppforest2::cli::serve::Response |
| Status, body, MIME content type, and extra response headers. More... | |
Namespaces | |
| namespace | ppforest2 |
| Binarization strategies for multiclass-to-binary reduction. | |
| namespace | ppforest2::cli |
| Command-line interface: argument parsing, subcommands, and benchmark/evaluation orchestration. | |
| namespace | ppforest2::cli::serve |
Functions | |
| Response | ppforest2::cli::serve::handle_health (std::string const &version) |
GET /health → 200 with status + version. | |
| Response | ppforest2::cli::serve::handle_predict (LoadedModel const &loaded, PredictionStore &store, std::string const &csv_body) |
POST /predict (Accept: application/json) → 200 with {predictions, [proportions], [metrics], id}. | |
| Response | ppforest2::cli::serve::handle_predict_html (LoadedModel const &loaded, PredictionStore &store, std::string const &csv_body) |
POST /predict (Accept: text/html) → 200 with the predict page rendered against the new result. Content-Location header points to the canonical /predict?id=<id> URL so the browser can update its address bar and share/refresh works. | |
| Response | ppforest2::cli::serve::handle_predict_view (LoadedModel const &loaded, PredictionStore const &store, std::string const &id_query) |
GET /predict → 200 with the predict page (always showing the upload form). When id_query refers to an entry still in the store, the results section is also populated. | |
| Response | ppforest2::cli::serve::handle_summarize (LoadedModel const &loaded) |
GET / (Accept: application/json) → 200 with the loaded model JSON, minus the heavy model field. | |
| Response | ppforest2::cli::serve::handle_summary_html (LoadedModel const &loaded) |
GET / (Accept: text/html) → 200 with a self-contained HTML page rendering meta, training metrics, and variable importance. | |
Pure request → response functions for the serve subcommand.
Handlers are pure functions of (cached model snapshot, request body) so they can be unit-tested without bringing up an HTTP server.