Low Bucket Observed Fraction
Check low-probability forecasts against the positive event rate inside the low bucket rather than the accuracy of predicting class zero.
The problem
A forecast of 0.20 does not claim that the positive outcome is impossible; it claims that roughly one row in five with a similar forecast should finish with y = 1. When rows strictly below cut are collected into the low bucket [0, cut), calibration still compares the bucket's mean predicted probability of y = 1 against the observed fraction of y = 1 inside that bucket.
Take eight rows [p, y]: (0.06, 0), (0.14, 0), (0.19, 1), (0.33, 0), (0.48, 0), (0.60, 1), (0.75, 1), and (0.90, 1). At cut = 0.5, five forecasts lie strictly below 0.5, and one of those five rows (0.19) finished positive. Is that single positive an error that spoils the bucket, or evidence that nonzero probabilities around 0.24 mean what they say?
Work through the numbers
Filter strictly by p < 0.5 to select the first five rows: 0.06, 0.14, 0.19, 0.33, and 0.48, giving low_count = 5. Their forecast sum is 0.06 + 0.14 + 0.19 + 0.33 + 0.48 = 1.20, so mean_predicted equals 1.20 / 5 = 0.24. Among five independent events averaging 0.24 probability, we expect 5 * 0.24 = 1.2 positives.
Sum the positive indicators y across those same five rows: 0 + 0 + 1 + 0 + 0 = 1. Dividing by 5 gives observed_fraction = 1 / 5 = 0.2. Comparing 0.24 against 0.2 shows a small gap of 0.24 - 0.2 = 0.04: the low bucket is close to well calibrated on this sample.
Confusion arises when a reader treats every low-bucket row as a hard class-zero prediction and computes the fraction of zeros: 4 / 5 = 0.8. Comparing mean_predicted (0.24) with class-zero accuracy (0.8) mixes two opposite events (y = 1 versus y = 0) and manufactures a phantom error of -0.56.
The live model
The top strip highlights the low-bucket forecasts below cut, marking positives green, negatives blue, and excluded high-bucket rows grey. On the shared [0.0, 1.0] scale, mean_predicted (0.24) and observed_fraction (0.2) sit side by side at cut = 0.5. Move cut down to 0.25 to keep three rows (0.13 vs 0.333), or up to 0.75 where the seventh row (forecast 0.75) stays excluded by strict < (6 rows: 0.3 vs 0.333).

let cut = scene.parameter("cut", 0.5, 0.25, 0.75, 0.25);
let p = input.select(1, 0);
let y = input.select(1, 1);
let mask = p.lt(cut).to(DType.F64);
let n_low = mask.sum();
let mean_pred = (p * mask).sum().div(n_low);
let obs_frac = (y * mask).sum().div(n_low);
let items = torch.list().add(n_low).add(mean_pred).add(obs_frac);
let answer = torch.stack(items, 0);
out.set("low_count", n_low.item()).set("mean_predicted", mean_pred.item());
out.set("observed_fraction", obs_frac.item());
{
"low_count": 5,
"mean_predicted": 0.24,
"observed_fraction": 0.2
}Watch the parameter change
Your turn
Even inside the low bucket [0, cut), calibration compares predicted probabilities of y = 1 against the empirical rate of y = 1. The starting model tracks the complementary negative rate 0.8 instead, making a well-calibrated 0.24 low bucket look wildly off. Return [n_low, mean_pred, obs_frac]. Check runs unseen tables at cut = 0.4 and cut = 0.6, including boundary scores on cut.

let cut = scene.parameter("cut", 0.5, 0.25, 0.75, 0.25);
let p = input.select(1, 0);
let y = input.select(1, 1);
let mask = p.lt(cut).to(DType.F64);
let n_low = mask.sum();
let mean_pred = (p * mask).sum().div(n_low);
let obs_frac = ((1.0 - y) * mask).sum().div(n_low);
let items = torch.list().add(n_low).add(mean_pred).add(obs_frac);
let answer = torch.stack(items, 0);
out.set("low_count", n_low.item()).set("mean_predicted", mean_pred.item());
out.set("observed_fraction", obs_frac.item());
{
"low_count": 5,
"mean_predicted": 0.24,
"observed_fraction": 0.8
}Low-bucket calibration still compares predicted positive probabilities against positive outcomes. The starting model reports the negative-outcome share 0.8 instead of 0.2. Return [n_low, mean_pred, obs_frac].
When the low bucket reports its positive-event rate, the green bar drops from 0.8 to 0.2 and the returned vector matches [5, 0.24, 0.2].
Read the result carefully
Zero observed positives in a low bucket is only calibrated when the bucket's forecasts are themselves near zero or the bucket holds very few rows. If twenty rows each carry forecast 0.30 and zero of them turn out positive, the bucket is overpredicting risk (0.30 promised versus 0.0 observed), even though a hard threshold at 0.5 would score 100% classification accuracy on those twenty rows. Calibration audits probability magnitudes that classification accuracy ignores.
Recap
- Keep every calibration bucket oriented toward the same target event
y = 1, whether forecasts sit near0.1or0.9. - Use strict
p.lt(cut)for the low bucket whenp.ge(cut)owns the cut value in the upper bucket. - Distinguish low-bucket calibration (
mean_prednearobs_frac) from hard-threshold accuracy on class zero.