9/16
Part 4 of 7 · CalibrationLearn and do
Fit the temperature on answers people checked
Temperature scaling divides the raw score by one number, fit on answers people checked, before turning it into a probability. It never changes which answers rank above which, so the precision and recall at any rank stay put. What it fixes is the meaning of the number, which is what makes a threshold like 0.9 safe to write into a policy.
To fit it, try each temperature on a grid, and keep the one whose probabilities give the lowest log loss on the checked answers: −log p for a supported answer, and −log(1 − p) for one that wasn't.
In the editor, write fit_temperature(logits, labels, grid). It fits the simulated checker, then prints the calibration error at that temperature.