pub fn max_error<F, S1, S2, D1, D2>(
y_true: &ArrayBase<S1, D1>,
y_pred: &ArrayBase<S2, D2>,
) -> Result<F>Expand description
Calculates the maximum error
Maximum error is the maximum absolute difference between the true and predicted values.
§Arguments
y_true- Ground truth (correct) target valuesy_pred- Estimated target values
§Returns
- The maximum error
§Examples
use scirs2_core::ndarray::array;
use scirs2_metrics::regression::max_error;
let y_true = array![3.0, -0.5, 2.0, 7.0];
let y_pred = array![2.5, 0.0, 2.0, 8.0];
let me = max_error(&y_true, &y_pred).unwrap();
// Maximum of [|3.0-2.5|, |-0.5-0.0|, |2.0-2.0|, |7.0-8.0|]
assert_eq!(me, 1.0);