Realm

oa::ml::metric::ConfusionCounts

Per-class actual×predicted integer counts behind one-vs-rest metrics. Counts merge by elementwise addition, so arbitrarily partitioned evaluation is exact. Precision, recall, and F1 — macro and micro — derive only at observation time, never per batch. A class absent from both predictions and labels reports zero for its derived values, matching the existing host contract; micro ratios with a zero denominator report NaN.

StRust public API

Declaration

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

Public Methods

pub fn update(&mut self, predicted: &[u32], actual: &[u32]) -> Result<()>
pub fn update_device(&mut self, logits: &Matrix, labels: &Matrix) -> Result<()>
pub fn merge(&mut self, other: &Self) -> Result<()>
pub fn class_counts(&self, class_index: usize) -> (u64, u64, u64)
pub fn macro_precision(&self) -> f64
pub fn macro_recall(&self) -> f64
pub fn macro_f1(&self) -> f64
pub fn micro(&self) -> (f64, f64, f64)
pub fn accuracy(&self) -> f64
pub fn table(&self) -> &[u64]
pub const fn classes(&self) -> usize
pub fn reset(&mut self)
fn clone(&self) -> ConfusionCounts
fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn eq(&self, other: &ConfusionCounts) -> bool

Associated Functions

pub fn new(classes: usize) -> Self
fn default() -> ConfusionCounts

Public Method Documentation

pub fn update(&mut self, predicted: &[u32], actual: &[u32]) -> Result<()>
No public source comment is attached to this declaration.
pub fn update_device(&mut self, logits: &Matrix, labels: &Matrix) -> Result<()>
No public source comment is attached to this declaration.
pub fn merge(&mut self, other: &Self) -> Result<()>
No public source comment is attached to this declaration.
pub fn class_counts(&self, class_index: usize) -> ( u64, u64, u64 )
No public source comment is attached to this declaration.
pub fn macro_precision( &self ) -> f64
No public source comment is attached to this declaration.
pub fn macro_recall( &self ) -> f64
No public source comment is attached to this declaration.
pub fn macro_f1( &self ) -> f64
No public source comment is attached to this declaration.
pub fn micro(&self) -> ( f64, f64, f64 )
No public source comment is attached to this declaration.
pub fn accuracy( &self ) -> f64
No public source comment is attached to this declaration.
pub fn table( &self ) -> &[u64]
No public source comment is attached to this declaration.
pub const fn classes( &self ) -> usize
No public source comment is attached to this declaration.
pub fn reset( &mut self )
No public source comment is attached to this declaration.
fn clone( &self ) -> ConfusionCounts
No public source comment is attached to this declaration.
fn fmt( &self, f: &mut Formatter<'_> ) -> Result
No public source comment is attached to this declaration.
fn eq( &self, other: &ConfusionCounts ) -> bool
No public source comment is attached to this declaration.
pub fn new( classes: usize ) -> Self
No public source comment is attached to this declaration.
fn default() -> ConfusionCounts
No public source comment is attached to this declaration.