expected_calibration_error¶
-
pycalib.scoring.
expected_calibration_error
(y, p_pred, n_bins=100, n_classes=None, p=1)[source]¶ Computes the expected calibration error ECE_p.
Computes the empirical p-expected calibration error for a vector of confidence estimates by binning.
- Parameters
y (array-like) – Ground truth labels.
p_pred (array-like) – Array of confidence estimates.
n_bins (int, default=15) – Number of bins of \([\frac{1}{n_{\text{classes}},1]\) for the confidence estimates.
n_classes (int default=None) – Number of classes. Estimated from y and y_pred if not given.
p (int, default=1) – Power of the calibration error, \(1 \leq p \leq \infty\).
- Returns
Expected calibration error
- Return type