Sub topic 14
Alerting and Reconciling Estimates with Ground Truth
Assume you know binary classification metrics, prediction logs, pandas, and scikit-learn. This chapter combines delayed-label evaluation with earlier estimates such as drift signals, calibrated probabilities, and importance-weighted scores.
Why one metric is not enough
A production monitor may need to act today, but the true outcome may arrive weeks later. A label-free estimate can provide an early warning, while a matured cohort can provide stronger evidence later.
Treat these as different measurements:
- Early estimate: available soon, but depends on assumptions.
- Matured ground truth: based on observed labels after the maturity window.
- Coverage: the fraction of predictions old enough to evaluate.
- Reconciliation: comparing an earlier estimate with the later ground-truth result.
An alert should identify which measurement caused it. An alert based on drift is different from an alert based on a confirmed performance decline.
| Signal | Available | Main strength | Main limitation |
|---|---|---|---|
| Feature or prediction drift | Quickly | Detects changed inputs or scores | Drift does not prove worse performance |
| Calibrated expected accuracy | Quickly | Uses current predictions without labels | Requires calibration to remain valid |
| Matured-cohort AUC | After labels mature | Directly measures ranking quality | It describes an earlier cohort |
| Weighted estimate | After reference labels | Adjusts for covariate shift | Sensitive to model and overlap assumptions |
A practical alert policy
Use separate thresholds for warning and critical states. Require enough observations before evaluating a metric. Otherwise, a small sample can produce unstable values.
A policy can follow this sequence:
- Record predictions with a prediction time, model version, score, and stable identifier.
- Compute label-free signals continuously.
- Compute metrics on cohorts older than the maturity window.
- Record label coverage and the cohort's prediction-time range.
- Compare estimates with later ground truth.
- Alert or resolve the incident according to the signal and confidence.
Reconcile estimates with matured metrics
The following example compares an expected-accuracy estimate with the observed accuracy for a cohort whose labels have arrived. It also prevents a decision when the cohort is too small.
import pandas as pd
rows = [
{"cohort": "2026-11-01", "expected_accuracy": 0.91,
"observed_accuracy": 0.88, "n": 2400},
{"cohort": "2026-11-08", "expected_accuracy": 0.90,
"observed_accuracy": 0.89, "n": 2600},
]
results = pd.DataFrame(rows)
minimum_n = 1000
warning_gap = 0.03
critical_gap = 0.05
results["gap"] = (
results["expected_accuracy"] - results["observed_accuracy"]
).abs()
def classify(row):
if row["n"] < minimum_n:
return "insufficient_data"
if row["gap"] >= critical_gap:
return "critical_reconciliation_gap"
if row["gap"] >= warning_gap:
return "warning_reconciliation_gap"
return "reconciled"
results["status"] = results.apply(classify, axis=1)
print(results[["cohort", "n", "gap", "status"]])A large gap means the estimate did not predict reality well for that cohort. Investigate calibration, data drift, selection bias, and changes in the label-generation process. Do not automatically conclude that the production model is failing.
Make alerts explainable and actionable
Include these fields in every alert:
- model version and deployment interval
- metric name and threshold
- prediction-time cohort
- number of predictions and label coverage
- estimate, observed value, and reconciliation gap
- data-quality and drift status
- link to the saved cohort and query used
A useful severity policy separates evidence from action:
- Informational: drift changed, but no performance estimate crossed a threshold.
- Warning: an estimate crossed a threshold, or a reconciliation gap is large.
- Critical: a matured metric crossed its critical threshold with adequate coverage and sample size.
- Resolved: a later cohort returns within limits, or an investigation confirms a transient issue.
Recompute historical cohorts after fixing data pipelines or label definitions. Preserve the original result, the corrected result, and the reason for the change so alert history remains auditable.
Exercise
A calibrated expected accuracy falls sharply, but the latest matured cohort remains healthy. What should you do first?
Show answer
Check calibration, feature and prediction drift, sample size, label coverage, and cohort alignment before changing the model. Treat the estimate as an investigation signal, not confirmed degradation.