Skip to main content

TrainingSummary

Struct TrainingSummary 

Source
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

Source

pub fn new(config: TrainingSummaryConfig) -> Result<Self, RillError>

Create a new training summary with the given configuration.

Source

pub fn record_sample(&mut self)

Record that a sample was processed.

Source

pub fn record_rejection(&mut self)

Record that an input was rejected (invalid, non-finite, etc.).

Source

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.

Source

pub fn set_baseline_error(&mut self, error: f64) -> Result<(), RillError>

Set the baseline error for comparison.

Source

pub fn record_switch(&mut self)

Record that the active model was switched.

Source

pub fn record_reset(&mut self)

Record that the model was reset.

Source

pub fn record_load_failure(&mut self)

Record that a state load failed.

Source

pub const fn total_samples(&self) -> u64

Total samples processed.

Source

pub const fn rejected_samples(&self) -> u64

Samples rejected due to invalid input.

Source

pub fn recent_error(&self) -> Option<f64>

Recent error (EW mean of absolute errors), or None if no errors recorded.

Source

pub const fn best_error(&self) -> Option<f64>

Best (minimum) error observed, or None if no errors recorded.

Source

pub const fn baseline_error(&self) -> Option<f64>

Baseline error for comparison, or None if not set.

Source

pub const fn model_switches(&self) -> u64

Number of times the active model was switched.

Source

pub const fn reset_count(&self) -> u64

Number of times the model was reset.

Source

pub const fn load_failures(&self) -> u64

Number of state load failures.

Source

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.

Source

pub fn reset(&mut self)

Reset all summary statistics.

Trait Implementations§

Source§

impl Clone for TrainingSummary

Source§

fn clone(&self) -> TrainingSummary

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TrainingSummary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TrainingSummary

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V