Expected Calibration Error for Binary Classification
Source:R/Metrics_ECE_calibration.R
ece_confidence_binary.RdCalculates Expected Calibration Error (ECE) or Adaptive ECE
for a binary classifier, reproducing the behaviour of
pyhealth.metrics.calibration.ece_confidence_binary.
Arguments
- prob
Numeric vector or two-column matrix \ containing predicted probabilities for the positive class (only the first column is used if a matrix is supplied).
- label
Numeric vector or two-column matrix of true labels \ encoded as 0/1 (only the first column is used if a matrix is supplied).
- bins
Integer. Number of bins (default 20).
- adaptive
Logical. If
FALSE(default) equal-width bins \ spanning \(0,1\) are used; ifTRUEeach bin contains the \ same number of samples (equal-size bins).