pub trait Loss: Debug {
// Required methods
fn compute(
&self,
predictions: &ArrayView<'_, f64, Ix2>,
targets: &ArrayView<'_, f64, Ix2>,
) -> TrainResult<f64>;
fn gradient(
&self,
predictions: &ArrayView<'_, f64, Ix2>,
targets: &ArrayView<'_, f64, Ix2>,
) -> TrainResult<Array<f64, Ix2>>;
// Provided method
fn name(&self) -> &str { ... }
}Expand description
Trait for loss functions.