Sub topic 11
Handling delayed and missing labels
This chapter assumes you can read short Python snippets and know the model metrics from earlier chapters, such as precision and recall. You should also know that shadow, canary and A/B rollouts all compare a candidate model with the stable one on live traffic. Here we deal with a problem that sits under all three: the true outcome is often not known when you need to decide.
Why labels are late or absent
A label is the true outcome for a prediction. Many production systems learn it slowly, partially or never.
- Fraud: a chargeback can arrive 30 to 60 days after the transaction.
- Loan default: the outcome takes months or years.
- Recommendations: a purchase may happen days after the click.
- Moderation: only a small sample is ever reviewed by a human.
- Selection effects: if the model blocks a transaction, you never learn whether it was fraud.
A rollout decision cannot wait for every label. Treating unlabeled rows as negatives, or comparing groups at different label ages, produces wrong conclusions. The sections below cover how to avoid that.
Delay, censoring, and missingness
Three situations look alike in a dashboard but need different handling.
| Situation | What it means | Typical fix |
|---|---|---|
| Delayed label | The outcome exists but has not arrived yet | Wait for a maturity window, or use a proxy meanwhile |
| Censored label | The observation window ended before the outcome could happen | Report only on cohorts old enough to be complete |
| Missing not at random | The label exists only for some rows, chosen by the model or a process | Holdout, exploration, or reweighting |
A row with no label is not a row with a negative label. Until the maturity window closes, "no chargeback yet" only means "no chargeback so far".
The maturity window
Pick a maturity window from the label arrival distribution, not from a guess. Take historical data and find the delay between prediction and label. A common choice is the delay by which 95% or 99% of labels have arrived.
Then apply two rules:
- Compute label-based metrics only on predictions older than the window.
- Compare both variants over the same prediction cohort, so each has had the same time to collect labels.
The first rule means your label-based result always lags by the window length. With a 30-day window, a prediction made today is scored a month from now.
Computing metrics on matured cohorts
The function below groups predictions by variant and keeps only those older than the maturity window. In this fraud example, a matured prediction with no chargeback is counted as legitimate, because the window has closed and the label can no longer plausibly arrive.
from datetime import datetime, timedelta
def matured_report(predictions, chargebacks, now, maturity):
cutoff = now - maturity
stats = {}
for p in predictions:
if p["ts"] > cutoff:
continue # too young: label may still arrive
s = stats.setdefault(p["variant"], {"n": 0, "chargebacks": 0})
s["n"] += 1
s["chargebacks"] += 1 if p["id"] in chargebacks else 0
for s in stats.values():
s["rate"] = s["chargebacks"] / s["n"]
return stats
now = datetime(2026, 11, 30)
predictions = [
{"id": "p1", "variant": "stable", "ts": datetime(2026, 10, 1)},
{"id": "p2", "variant": "candidate", "ts": datetime(2026, 10, 2)},
{"id": "p3", "variant": "stable", "ts": datetime(2026, 10, 3)},
{"id": "p4", "variant": "candidate", "ts": datetime(2026, 10, 4)},
{"id": "p5", "variant": "candidate", "ts": datetime(2026, 11, 20)},
]
chargebacks = {"p1", "p4"}
report = matured_report(predictions, chargebacks, now, timedelta(days=30))
for variant in sorted(report):
s = report[variant]
print(f"{variant}: n={s['n']} chargebacks={s['chargebacks']} rate={s['rate']:.2f}")The output is:
candidate: n=2 chargebacks=1 rate=0.50
stable: n=2 chargebacks=1 rate=0.50Prediction p5 is ten days old, so it is excluded. Without the cutoff, the candidate would look better than it is, because its newest prediction has no chargeback yet.
Using proxies while you wait
You cannot wait 30 days to detect a broken canary. Use faster signals for early gating and keep the true label for the final decision.
- Immediate signals: error rate, latency, null or out-of-range outputs, and the score distribution of the candidate versus the stable model. These work for shadow and canary guardrails with no labels at all.
- Proxy outcomes: early events correlated with the real label, such as a customer disputing a charge within 3 days, or a click instead of a purchase.
- Partial labels: the share of labels that has arrived so far, used with a correction for late arrivals.
A proxy is only useful if you have checked how well it predicts the true label on historical data. Record that check. A proxy can also move in a different direction from the true outcome, for example when a model that boosts clicks lowers purchases. For that reason, treat proxy results as grounds for stopping a rollout, not as proof of success.
Missing labels caused by the model itself
Some labels are missing because of the decision the model made. If the stable model blocks a transaction, the customer never completes it and you never see whether it was fraud. If a candidate blocks a different set, the labeled populations of the two variants differ, and their metrics are not comparable.
Common remedies:
- Holdout or exploration traffic: let a small random share (for example 1%) through unblocked, and label it. This gives an unbiased sample at a known cost.
- Reweighting: weight each labeled row by one over its probability of being labeled. This works only if you log that probability and it is never zero.
- Outcome-independent metrics: compare decision rates, such as the share blocked, in addition to accuracy, so a change in who is labeled is visible.
- Manual review samples: randomly sample decisions for human labeling, stratified by variant and by score band.
In a shadow deployment this problem is milder, because the candidate's decisions are never applied. You can compare the candidate's score with the label produced under the stable model's decisions, but remember that those labels still reflect the stable model's selection.
Effects on A/B tests and canaries
Delayed labels interact with the experiment mechanics from the earlier chapters.
- Sample size is counted in matured units. If you need 20,000 matured conversions per arm, count only predictions past the window.
- Peeking gets worse. Early looks at immature data show whatever the fast-arriving labels show. Fast labels are often a biased subset, for example quick refunds and not slow ones.
- Analysis date matters. Fix the date at which you read labels before the experiment starts, and write it into the plan.
- Do not stop traffic assignment while waiting. Keep the assignment sticky and unchanged until the final cohort matures, or you will mix exposure levels.
- Rollback cannot wait for labels. Guardrails based on immediate signals must trigger rollback. Label-based metrics confirm the promotion decision later.
A practical pattern is a two-stage gate. Stage one uses system metrics and proxies to advance the canary from 5% to 25%. Stage two uses matured labels to decide full promotion. If a late label reveals a regression after full promotion, keep the previous model version available for rollback for at least the length of the maturity window.
Common errors
- Treating "no label yet" as a negative label before the window has closed.
- Reporting a single metric over cohorts of mixed age.
- Choosing the window from intuition and not from the observed arrival delay.
- Measuring only labeled rows when the model decides which rows get labels.
- Using a proxy that was never validated against the true outcome.
- Changing the model during the window, so the matured cohort contains more than one version. Always log the model version with each prediction.
Exercise
A canary receives 10% of traffic for 7 days. Chargebacks arrive up to 45 days after a transaction. On day 7 the candidate shows a lower chargeback rate than the stable model, 0.4% against 0.6%. Why is this not enough to promote it, and what two things would you do?
Show answer
Most of the candidate's transactions are less than 45 days old, so most of their chargebacks have not arrived yet, which makes its rate look artificially low. The stable model's rate may come from older, more complete data. First, compare both variants on the same cohort and only after the maturity window (about 45 days, or the 95th percentile of the historical arrival delay), so the labels are complete. Second, in the meantime gate the canary on immediate signals and a validated proxy, such as error rate, latency, score distribution and early disputes, and keep the stable version ready for rollback.
Exercise
A fraud model blocks high-risk transactions. You want to compare a candidate with the stable model on recall, but blocked transactions never get a fraud label. Name one way to get an unbiased comparison and one cost of it.
Show answer
Send a small random share of traffic (for example 1%) through without blocking and label it, then compute recall on that sample for both models' scores. The cost is that some fraud will go through on that sample, so the share must be small and approved by the business.