use crate::error::MetricsError;
use scirs2_core::ndarray::{Array, IxDyn};
use scirs2_core::numeric::Float;
use std::fmt::{Debug, Display};
pub trait MetricComputation<F: Float + Debug + Display> {
fn compute(
&self,
predictions: &Array<F, IxDyn>,
targets: &Array<F, IxDyn>,
) -> Result<F, MetricsError>;
fn name(&self) -> &str;
}
pub trait MetricCallback<F: Float + Debug + Display> {
fn on_train_begin(&mut self);
fn on_batch_end(
&mut self,
batch: usize,
predictions: &Array<F, IxDyn>,
targets: &Array<F, IxDyn>,
);
fn on_epoch_end(&mut self, epoch: usize) -> Result<(), MetricsError>;
fn on_train_end(&mut self);
}