Skip to main content

Numeric

Trait Numeric 

pub trait Numeric {
    // Required methods
    fn value(&self) -> Option<NumericEntry>;
    fn running_value(&self) -> Option<NumericEntry>;
    fn final_value(&self) -> NumericEntry;
}
Expand description

Declare a metric to be numeric.

This is useful to plot the values of a metric during training.

Some metrics (e.g. accuracy) produce a meaningful value on every batch, while others (e.g. AUC-PR) only accumulate state per batch and are computed once all state has been accumulated.. For the latter, value and running_value return None until that epoch-level computation has happened, signaling that no value has been computed for the current step.

Required Methods§

fn value(&self) -> Option<NumericEntry>

Returns the numeric value of the metric, or None if this metric has no meaningful value yet (e.g. it only accumulates state per batch and computes its value once all state has been accumulated).

fn running_value(&self) -> Option<NumericEntry>

Returns the current aggregated value of the metric over the global step, or None if this metric has no meaningful value yet (e.g. it only accumulates state per batch and computes its value once all state has been accumulated).

fn final_value(&self) -> NumericEntry

Returns the final, authoritative value of the metric for the epoch. Only meaningful after Metric::compute has been called.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§