Skip to main content

Metric

Trait Metric 

Source
pub trait Metric {
    // Required methods
    fn compute(
        &self,
        predictions: &ArrayView<'_, f64, Ix2>,
        targets: &ArrayView<'_, f64, Ix2>,
    ) -> TrainResult<f64>;
    fn name(&self) -> &str;

    // Provided method
    fn reset(&mut self) { ... }
}
Expand description

Trait for metrics.

Required Methods§

Source

fn compute( &self, predictions: &ArrayView<'_, f64, Ix2>, targets: &ArrayView<'_, f64, Ix2>, ) -> TrainResult<f64>

Compute metric value.

Source

fn name(&self) -> &str

Get metric name.

Provided Methods§

Source

fn reset(&mut self)

Reset metric state (for stateful metrics).

Implementors§