How does temperature scaling calibrate a classifier's probabilities?
mediumAnswer
- You take the trained logits z, divide by a scalar T > 0, then softmax: p = softmax(z / T).
- T is fit on a held-out validation set by minimizing NLL.
- T > 1 sharpens toward uniform (softens overconfident predictions — the typical case for deep nets); T < 1 sharpens toward one-hot.
- It changes only confidence, not the argmax, so accuracy is unchanged but calibration (ECE, Brier) improves.
- Cheap, single-parameter, widely used for post-hoc calibration.
Check yourself — multiple choice
- It scales the input features by T
- Divide logits by T and softmax; T is fit on validation to improve calibration
- It replaces the loss function during training
- It changes the model's predicted class
Divide logits by T; T fit on val. Doesn't change argmax — only confidence.
#calibration#classification
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- What is log loss (cross-entropy) and what does a specific value mean?
- What is the Brier score and how does it compare to log loss?
- What is Youden's J statistic and how is it used?
- How do you select the decision threshold for a binary classifier?
- Precision vs recall — when do you optimize each?
- Why is logistic regression called a linear model if it uses a sigmoid?