pub struct PredictionReporter { /* private fields */ }Expand description
Diagnostic wrapper that integrates interval estimation, warmup tracking, and training summary statistics.
Produces a PredictionReport for each prediction without storing raw
samples. The underlying model API is not affected: callers feed
(prediction, truth) pairs via observe and request a
report via report when needed.
§Examples
use rill_ml::diagnostics::PredictionReporter;
let mut reporter = PredictionReporter::default();
reporter.observe(10.0, 11.0).unwrap();
reporter.observe(10.0, 9.0).unwrap();
let report = reporter.report(10.0).unwrap();
assert_eq!(report.prediction(), 10.0);
assert!(report.lower_bound().is_some());
assert_eq!(report.samples_seen(), 2);Implementations§
Source§impl PredictionReporter
impl PredictionReporter
Sourcepub fn new(
interval_config: ResidualIntervalConfig,
warmup_config: WarmupConfig,
summary_config: TrainingSummaryConfig,
) -> Result<Self, RillError>
pub fn new( interval_config: ResidualIntervalConfig, warmup_config: WarmupConfig, summary_config: TrainingSummaryConfig, ) -> Result<Self, RillError>
Create a new reporter with the given configurations.
Each sub-component is constructed independently; configuration errors
are propagated as RillError.
Sourcepub fn observe(&mut self, prediction: f64, truth: f64) -> Result<(), RillError>
pub fn observe(&mut self, prediction: f64, truth: f64) -> Result<(), RillError>
Observe a prediction and its ground truth.
Updates the interval estimator, warmup tracker, and training summary. Non-finite inputs are rejected before any state is mutated.
Sourcepub fn set_baseline(&mut self, baseline: f64) -> Result<(), RillError>
pub fn set_baseline(&mut self, baseline: f64) -> Result<(), RillError>
Set the baseline error for comparison.
Propagates to both the warmup tracker and the training summary.
Sourcepub fn report(&self, prediction: f64) -> Result<PredictionReport, RillError>
pub fn report(&self, prediction: f64) -> Result<PredictionReport, RillError>
Build an immutable report for the given prediction.
If the interval estimator has insufficient data, the bounds are set to
None and no error is returned. Non-finite prediction values are
rejected.
Sourcepub fn summary(&self) -> &TrainingSummary
pub fn summary(&self) -> &TrainingSummary
Borrow the underlying training summary.
Sourcepub fn warmup_state(&self) -> WarmupState
pub fn warmup_state(&self) -> WarmupState
Current warmup state.
Sourcepub fn recent_error(&self) -> Option<f64>
pub fn recent_error(&self) -> Option<f64>
Recent (EW mean) absolute error, or None if no errors recorded.
Trait Implementations§
Source§impl Clone for PredictionReporter
impl Clone for PredictionReporter
Source§fn clone(&self) -> PredictionReporter
fn clone(&self) -> PredictionReporter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more