def fit_temperature(probs, gold_idx): return min(T_GRID, key=lambda t: nll([temper(p, t) for p in probs], gold_idx))