pub struct TrainingSummary { /* private fields */ }Expand description
Bounded-memory summary of a training process.
Tracks counts, recent/best errors, model switches, resets, and load failures. Does not store raw samples.
§Examples
use rill_ml::diagnostics::TrainingSummary;
let mut summary = TrainingSummary::default();
summary.record_sample();
summary.record_error(0.5).unwrap();
summary.set_baseline_error(0.8).unwrap();
assert_eq!(summary.total_samples(), 1);
assert!(summary.beats_baseline().unwrap());Implementations§
Source§impl TrainingSummary
impl TrainingSummary
Sourcepub fn new(config: TrainingSummaryConfig) -> Result<Self, RillError>
pub fn new(config: TrainingSummaryConfig) -> Result<Self, RillError>
Create a new training summary with the given configuration.
Sourcepub fn record_sample(&mut self)
pub fn record_sample(&mut self)
Record that a sample was processed.
Sourcepub fn record_rejection(&mut self)
pub fn record_rejection(&mut self)
Record that an input was rejected (invalid, non-finite, etc.).
Sourcepub fn record_error(&mut self, error: f64) -> Result<(), RillError>
pub fn record_error(&mut self, error: f64) -> Result<(), RillError>
Record an error from a prediction.
The absolute value is taken, so signed errors are accepted. Updates the recent error (EW mean) and the best (minimum) error.
Sourcepub fn set_baseline_error(&mut self, error: f64) -> Result<(), RillError>
pub fn set_baseline_error(&mut self, error: f64) -> Result<(), RillError>
Set the baseline error for comparison.
Sourcepub fn record_switch(&mut self)
pub fn record_switch(&mut self)
Record that the active model was switched.
Sourcepub fn record_reset(&mut self)
pub fn record_reset(&mut self)
Record that the model was reset.
Sourcepub fn record_load_failure(&mut self)
pub fn record_load_failure(&mut self)
Record that a state load failed.
Sourcepub const fn total_samples(&self) -> u64
pub const fn total_samples(&self) -> u64
Total samples processed.
Sourcepub const fn rejected_samples(&self) -> u64
pub const fn rejected_samples(&self) -> u64
Samples rejected due to invalid input.
Sourcepub fn recent_error(&self) -> Option<f64>
pub fn recent_error(&self) -> Option<f64>
Recent error (EW mean of absolute errors), or None if no errors recorded.
Sourcepub const fn best_error(&self) -> Option<f64>
pub const fn best_error(&self) -> Option<f64>
Best (minimum) error observed, or None if no errors recorded.
Sourcepub const fn baseline_error(&self) -> Option<f64>
pub const fn baseline_error(&self) -> Option<f64>
Baseline error for comparison, or None if not set.
Sourcepub const fn model_switches(&self) -> u64
pub const fn model_switches(&self) -> u64
Number of times the active model was switched.
Sourcepub const fn reset_count(&self) -> u64
pub const fn reset_count(&self) -> u64
Number of times the model was reset.
Sourcepub const fn load_failures(&self) -> u64
pub const fn load_failures(&self) -> u64
Number of state load failures.
Sourcepub fn beats_baseline(&self) -> Option<bool>
pub fn beats_baseline(&self) -> Option<bool>
Whether the model is currently beating the baseline.
Returns None if either recent error or baseline error is unavailable.
Trait Implementations§
Source§impl Clone for TrainingSummary
impl Clone for TrainingSummary
Source§fn clone(&self) -> TrainingSummary
fn clone(&self) -> TrainingSummary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more