StreamingMetric

Trait StreamingMetric 

Source
pub trait StreamingMetric<T> {
    type State;

    // Required methods
    fn init_state(&self) -> Self::State;
    fn update_state(
        &self,
        state: &mut Self::State,
        batch_true: &[T],
        batch_pred: &[T],
    ) -> Result<()>;
    fn finalize(&self, state: &Self::State) -> Result<f64>;
}
Expand description

Trait for streaming computation of metrics

This trait allows metrics to be computed incrementally without loading the entire dataset into memory at once.

Required Associated Types§

Source

type State

Type for intermediate state

Required Methods§

Source

fn init_state(&self) -> Self::State

Initialize the state

Source

fn update_state( &self, state: &mut Self::State, batch_true: &[T], batch_pred: &[T], ) -> Result<()>

Update the state with a new batch of data

Source

fn finalize(&self, state: &Self::State) -> Result<f64>

Compute the final metric from the state

Implementors§