Given per-sample predicted-class confidences, predicted classes, and true labels, compute ECE with equal-width binning.
Signature: def ece(confidences: list, predictions: list, labels: list, n_bins: int = 10) -> float
[0, 1] into n_bins equal-width bins.gap = | accuracy - mean_confidence | * (bin_count / N)The last bin should be inclusive on the right edge (so confidence == 1.0 falls into the last bin, not outside).
Math
Asked at
Test Results