International Journal of Research and Development in Engineering Sciences
Open Access publication.
Analytical Characterization of Finite-Sample Bias in Expected Calibration Error for Probabilistic Classifiers using Artificial Intelligence
Abstract
The expected calibration error (ECE) is the standard number for reporting how well a classifier’s probabilities match observed frequencies, and it is computed from a finite sample by binning. Because the estimate is an average of absolute values of noisy bin differences, it is biased upwards, and the bias is large at the sample sizes in which models are often evaluated. We derive the expected value of the binned estimate in closed form: each bin contributes the mean of a folded normal distribution, which gives ?wbF(?b, ?b), and for a perfectly calibrated model the estimate has mean s??(2B/(?n)) with B bins and n cases. Over 75 simulated settings the formula was within 5.3% of the simulated mean (average 1.3%). A perfectly calibrated model evaluated on 1,000 cases with 15 bins has an expected ECE of 3.8%, and keeping it below 1 point needs about 9,900 cases with 10 bins. The sample size is proportional to the number of bins, so the choice of bins trades bias from noise against bias from binning, and the root mean squared error is smallest at a small number of bins (3, 5 and 12 for 300, 1,000 and 5,000 cases in our setting). Correcting the noise is not straightforward: subtracting the expected noise works for calibrated models but understates the error of miscalibrated ones by up to 3 points, while inverting the folded normal in each bin removes most of the bias for miscalibrated models, is not uniformly better in root mean squared error, and is worse for calibrated ones. On the breast cancer and digits datasets, the estimate for a model with weak features was 16.2% with 50 cases and 6.0% on all cases. Synthetic results are simulations; the real data are two small benchmark sets.
Keywords: Calibration, Expected Calibration Error, Binning, Bias, Folded Normal, Sample Size
How to cite this article
CrossRef DOI: https://doi.org/10.63328/ijrdes-v8ri6p6