pub fn error_histogram<F, S1, S2, D1, D2>(
y_true: &ArrayBase<S1, D1>,
y_pred: &ArrayBase<S2, D2>,
n_bins: usize,
) -> Result<ErrorHistogram<F>>Expand description
Calculates a histogram of error/residual values
§Arguments
y_true- Ground truth (correct) target valuesy_pred- Estimated target valuesn_bins- Number of bins for the histogram
§Returns
- An
ErrorHistogramstruct containing the histogram data
§Examples
use scirs2_core::ndarray::array;
use scirs2_metrics::regression::error_histogram;
let y_true = array![3.0, -0.5, 2.0, 7.0, 5.0, 8.0, 1.0, 4.0];
let y_pred = array![2.5, 0.0, 2.0, 8.0, 4.5, 7.5, 1.5, 3.5];
let hist = error_histogram(&y_true, &y_pred, 4).unwrap();
assert_eq!(hist.bin_counts.len(), 4);
assert_eq!(hist.bin_edges.len(), 5);
assert_eq!(hist.n_observations, 8);