Skip to main content

Metric

Trait Metric 

Source
pub trait Metric {
    // Required methods
    fn compute(&self, predictions: &Tensor, targets: &Tensor) -> f32;
    fn name(&self) -> &str;

    // Provided method
    fn higher_is_better(&self) -> bool { ... }
}
Expand description

Trait for evaluation metrics

Required Methods§

Source

fn compute(&self, predictions: &Tensor, targets: &Tensor) -> f32

Compute the metric given predictions and targets

Source

fn name(&self) -> &str

Name of the metric

Provided Methods§

Source

fn higher_is_better(&self) -> bool

Whether higher values are better (true) or lower (false)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§