skip to content

What does NannyML's CBPE need to estimate a churn model's ROC AUC before labels arrive, and when does that estimate mislead?

level: seniorimportance: should knowfreq 8%

answer

  1. a labelled reference, an unlabelled analysis
  2. scores, plus predictions for threshold metrics
  3. calibration fitted on the reference
  4. the score-to-outcome link must hold
  5. chunk size against sampling noise

basics

~20 s

NannyML's CBPE is fitted on a labelled reference period (y_true, y_pred_proba, and y_pred for threshold metrics), then estimates metrics per chunk from scores alone. It misleads under concept drift, under shift into input regions the reference never covered, and on chunks too small.

solid answer

~40 s

`CBPE` takes `problem_type` (`'classification_binary'` or `'classification_multiclass'`), `y_pred_proba`, `y_true`, `metrics` and an optional `y_pred`, which every metric except `roc_auc` and `average_precision` needs. `fit(reference)` needs true labels; `estimate(analysis)` needs only scores and predictions. On the reference it fits a calibrator (`calibration='isotonic'`, the only supported value) and then estimates each metric per chunk from expected confusion-matrix counts. Each metric's alert threshold defaults to a `StandardDeviationThreshold` over the reference chunks. NannyML's docs list the assumptions: calibrated probabilities, no concept drift (the link from inputs to outcome stays put), no shift into regions the reference never covered, and chunks large enough to estimate on. A new retention offer that changes who churns at a given score breaks the estimate silently. For regression NannyML provides `DLE` instead.

code

python · 14 lines
python
import nannyml as nml

estimator = nml.CBPE(
    problem_type="classification_binary",
    y_pred_proba="churn_score",
    y_pred="churn_flag",
    y_true="churned",
    metrics=["roc_auc", "f1"],
    timestamp_column_name="scored_at",
    chunk_period="W",
)
estimator.fit(reference_df)  # labelled period: churned is known
results = estimator.estimate(analysis_df)  # recent weeks: no labels yet
weekly = results.to_df()

go deeper

for a junior

Recall that CBPE estimates classification metrics without current labels, but is fitted on a reference period that has them.

for a middle

Explain the inputs: y_pred_proba and y_true for fit, y_pred for threshold metrics, isotonic calibration on the reference, chunking, and the standard-deviation alert thresholds.

for a senior

Name the documented assumptions and the churn cases that break each one, such as a new offer or an unseen segment, and how realised metrics later confirm or refute the estimate.

for a principal

Judge where a label-free estimate is trustworthy enough to act on across a model portfolio, and what refit and verification discipline keeps it honest.

## What CBPE estimates **NannyML** is an open-source Python library for post-deployment monitoring; its latest release is 0.13.1. **CBPE**, Confidence-Based Performance Estimation, estimates a classifier's performance metrics (ROC AUC, F1, precision, recall, specificity, accuracy, a confusion matrix or a business value) for periods whose true labels have **not arrived yet**. For a churn model whose outcomes are known only about two months after scoring, that turns an eight-week blind spot into a weekly estimate. CBPE covers binary and multiclass classification; regression has its own estimator. Why and when a team estimates before labels land is a design question of its own; this answer covers what the tool needs and assumes. ## Inputs at fit time and at estimate time | Argument | Meaning | Needed in reference (`fit`) | Needed in analysis (`estimate`) | |---|---|---|---| | `y_pred_proba` | score column; for multiclass a dict of class to column | yes | yes | | `y_pred` | thresholded prediction column | when a metric needs it | when a metric needs it | | `y_true` | true label column | **yes** | no | | `problem_type` | `'classification_binary'` or `'classification_multiclass'` | fixed at construction | fixed at construction | | `metrics` | for example `['roc_auc', 'f1']` | fixed at construction | fixed at construction | | `timestamp_column_name` | time axis for chunks and plots | optional | optional | Metrics other than `roc_auc` and `average_precision` need `y_pred`. Asking for `f1` without it raises an error at construction rather than guessing a cut-off. For multiclass problems `y_pred` is always required. Chunking is set with one of `chunk_size`, `chunk_number`, `chunk_period` (which also requires `timestamp_column_name`) or a `chunker`. Each chunk gets its own estimate. ## How the estimate is produced 1. On the reference, CBPE fits a **calibrator** that maps raw scores to probabilities matching observed outcome rates. `calibration='isotonic'` is the default and currently the only supported value; a custom `calibrator` can be passed. 2. For each analysis chunk, calibrated probabilities give the **expected** number of true positives, false positives, true negatives and false negatives at each threshold. 3. Metrics are computed from those expected counts; ROC AUC sweeps over the thresholds. 4. Each metric gets a default `StandardDeviationThreshold`, set from the spread of the metric across reference chunks, and chunks outside it raise an alert. ## The assumptions NannyML documents - **Well-calibrated probabilities**, or scores that calibrate well on the reference. NannyML notes this usually holds for good models whose remaining error is mostly irreducible. - **No concept drift.** CBPE stays accurate when the input distribution changes but the probability of the outcome given the inputs does not. If that relationship changes, the calibrated scores no longer describe reality, and NannyML notes that outside very specific cases concept drift cannot be identified without ground truth. - **No covariate shift into unseen regions.** If traffic moves into parts of the input space the reference never covered, the model's probabilities there are extrapolations. - **Large enough samples.** The estimate is an expectation and gets noisier as chunks shrink; NannyML's docs note that small samples make even realised metrics unreliable. ## Where it misleads on a churn model - A **retention offer** launched after the reference period changes who churns at a given score. That is a change in the outcome given the inputs, so CBPE keeps reporting the old relationship. - A **new customer segment**, such as a product line absent from the reference, puts scores into regions the calibrator never saw. - **Tiny chunks**, for example daily chunks of a few hundred subscribers, produce estimates that swing on sampling noise alone. - A changed **score pipeline** that rescales the score makes the reference calibration wrong for every later chunk. The practical check is to compute realised performance once labels land, with NannyML's `PerformanceCalculator`, and compare it with what CBPE estimated for the same chunks. A persistent gap means an assumption has broken. ## DLE for regression For regression models NannyML provides **DLE**, Direct Loss Estimation. It takes `feature_column_names`, `y_pred` and `y_true`, trains a LightGBM "nanny" model on the reference to predict the monitored model's loss, and estimates metrics such as `mae`, `mse`, `rmse`, `msle`, `rmsle` and `mape` per chunk. Like CBPE, it does not work under concept drift or on regions the reference never covered.

  • Which NannyML estimator replaces CBPE for a regression model, and what does it train?
    `DLE`, Direct Loss Estimation. Given `feature_column_names`, `y_pred` and `y_true`, it trains a LightGBM nanny model on the reference to predict the monitored model's loss, then estimates `mae`, `mse`, `rmse` and similar metrics per chunk. It shares CBPE's limits: concept drift and inputs from regions the reference never covered.
  • Two months later, realised ROC AUC is well below what CBPE estimated for the same weeks. What does that tell you?
    One of CBPE's assumptions broke: the link from scores to churn changed (concept drift, such as a new offer) or traffic moved into regions the reference never covered. Compare per-chunk realised metrics from `PerformanceCalculator` against the estimates, then refit on a newer labelled reference.

  • Says CBPE needs no labels at all, not even in the reference period
  • Claims CBPE can detect concept drift from model scores alone
  • Thinks CBPE can estimate f1 or accuracy from scores without y_pred
  • Sets problem_type='regression' to use CBPE on a regression model
  • Assumes smaller chunks make CBPE's estimate more responsive with no loss of reliability

Assumes NannyML 0.13.1 (released 2025-07-12, the latest release as of 2026-10-05); argument names and defaults are from that release's cbpe.py and dle.py.