Realm

oa::ml::training::AccuracyMetric

Device-resident training accuracy for classification steps. The metric owns a persistent accumulator: each AccuracyObserver::observe call inside the step’s record closure records the correctness count, its cast, and its accumulation — operations that capture into the training program and execute on every replay, so no per-step accuracy readback exists. The single observation is one readback per epoch boundary inside commit_epoch. Epoch isolation is exact cumulative differencing of both the device correct-count and the lifecycle’s exact sample accounting; integer counts in F32 are exact far beyond any training run (2^24 samples), so the counter never resets.

StRust public API

Declaration

pub struct AccuracyMetric { /* private fields */ }
Public Rust declaration.

Public Methods

pub fn observer(&self) -> AccuracyObserver
fn name(&self) -> &str
fn reset(&mut self)
fn update_step(&mut self, _state: TrainingSnapshot)
fn result(&self) -> f64
fn observe_batch(&mut self, prediction: &Matrix, target: &Matrix) -> Result<()>
fn commit_epoch( &mut self, context: &mut TrainingCallbackContext<'_>, ) -> Result<()>

Associated Functions

pub fn new(name: impl Into<String>) -> Result<Self>
pub fn new_with_runtime( runtime: &Runtime, name: impl Into<String>, ) -> Result<Self>

Public Method Documentation

pub fn observer( &self ) -> AccuracyObserver
No public source comment is attached to this declaration.
fn name( &self ) -> &str
Observe one batch’s prediction and target inside a managed fit. Read more
fn reset( &mut self )
Observe one batch’s prediction and target inside a managed fit. Read more
fn update_step( &mut self, _state: TrainingSnapshot )
Observe one batch’s prediction and target inside a managed fit. Read more
fn result( &self ) -> f64
Observe one batch’s prediction and target inside a managed fit. Read more
fn observe_batch(&mut self, prediction: &Matrix, target: &Matrix) -> Result<()>
No public source comment is attached to this declaration.
fn commit_epoch( &mut self, context: &mut TrainingCallbackContext<'_>, ) -> Result<()>
No public source comment is attached to this declaration.
pub fn new( name: impl Into<String> ) -> Result<Self>
No public source comment is attached to this declaration.
pub fn new_with_runtime( runtime: &Runtime, name: impl Into<String> ) -> Result<Self>
No public source comment is attached to this declaration.