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.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".