Calibration#
The calibration module provides methods for calibrating neural network predictions to ensure that confidence scores accurately reflect the true probability of correctness.
Post-hoc Calibration Methods#
|
Temperature scaling for calibration: scales logits by a learned temperature. |
|
Vector Scaling (Guo et al., 2017). |
|
Matrix Scaling (Guo et al., 2017). |
|
Dirichlet Calibration (Kull et al., 2019). |
|
Beta Calibration for binary classification (Kull et al., 2017). |
No-op calibrator that returns the original softmax probabilities. |
Training-time Calibration#
|
Label Smoothing for improved calibration. |
|
Focal Loss for handling hard examples. |
|
Confidence Penalty to prevent overconfidence. |
|
Temperature-aware training with learnable temperature. |
Metrics#
|
Expected Calibration Error (ECE). |
|
Maximum Calibration Error (MCE). |
|
Adaptive Expected Calibration Error (Nixon et al., 2019). |
|
Brier score: mean squared error between one-hot labels and predicted probabilities. |
Visualization#
|
Plot a reliability diagram comparing confidence vs accuracy. |
|
Plot a histogram of model confidences (max softmax probability). |
|
Plot calibration curve: accuracy vs. |