entrenar 0.7.13

Training & Optimization library with autograd, LoRA, quantization, and model merging
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Core Metric trait definition

use crate::Tensor;

/// Trait for evaluation metrics
pub trait Metric {
    /// Compute the metric given predictions and targets
    fn compute(&self, predictions: &Tensor, targets: &Tensor) -> f32;

    /// Name of the metric
    fn name(&self) -> &str;

    /// Whether higher values are better (true) or lower (false)
    fn higher_is_better(&self) -> bool {
        true
    }
}