oa::ml::TrainingMetric
Stateful metric updated once after each completed step. Snapshot-only loss-style metrics implement the four legacy methods. Prediction metrics need batch tensors the snapshot does not carry: they instead observe batches inside the step’s record closure (AccuracyObserver::observe) and commit their epoch result to the shared history bus through TrainingMetric::commit_epoch. New code should not add snapshot-only metrics; the snapshot path exists for scalars the lifecycle itself produces.
Declaration
pub trait TrainingMetric { // Required methods fn name(&self) -> &str; fn reset(&mut self); fn update_step(&mut self, state: TrainingSnapshot); fn result(&self) -> f64; // Provided methods fn commit_epoch( &mut self, _context: &mut TrainingCallbackContext<'_>, ) -> Result<()> { ... } fn observe_batch( &mut self, _prediction: &Matrix, _target: &Matrix, ) -> Result<()> { ... } }Public Rust declaration.
Public Methods
Public Method Documentation
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.