The interview problem

Practice prompt

A model predicts the duration of a data-processing job. Build a prediction interval intended to cover the actual duration at least 90% of the time. You have a separate calibration cohort of 19 jobs followed until all durations are observed. Explain the finite-sample threshold, what coverage means, and why a new customer workload can invalidate the claim.

Original fundamentals practice, not a reported company interview. Job durations and score examples are hypothetical. Primary reference retrieved September 27, 2026.

1. Freeze the model and define the score

Train the point predictor f on training data, then freeze it before using calibration labels. For each calibration pair (xᵢ, yᵢ), compute an absolute residual sᵢ = |yᵢ − f(xᵢ)| in minutes. A candidate output y for a new job x is included when |y − f(x)| is no larger than a calibrated threshold q.

Assume calibration pairs and the next test pair are exchangeable, conditional on the frozen training data and fitted scoring rule. Independent draws from the same population are a sufficient familiar case. The model and scoring rule must not be tuned on these same calibration outcomes in a way that breaks score exchangeability. Repeated jobs from one customer, time trends and selective completion can violate the simple setup.

The target is an interval for the next actual duration, not a confidence interval for a mean duration. The model can be inaccurate and still produce a valid but uselessly wide interval. Coverage and informativeness are separate evaluation dimensions.

2. Calculate the finite-sample rank

With n calibration scores and desired miscoverage 0 < α < 1, choose k = ceil((n + 1)(1 − α)). If k ≤ n, use the kth smallest calibration score. If k = n + 1, use an infinite threshold for the unrestricted residual-score construction. Use inclusion at the boundary, s ≤ q, so ties do not accidentally reduce coverage.

For n = 19 and α = 0.10, k = ceil(20 × 0.90) = 18. Consider these sorted residuals in minutes:

0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
1.1, 1.2, 1.3, 1.4, 1.5, 1.7, 2.0, 2.4, 3.0, 5.0

The 18th residual is 3.0. For a prediction of 12 minutes, return [9, 15]. For a prediction of 1 minute, the unconstrained interval is [−2, 4]. If durations are known to be nonnegative, intersect with that known support to obtain [0, 4]; removing impossible outcomes does not remove the true duration.

A generic interpolated percentile function is not automatically the required order statistic. Specify the rank explicitly and test it on small arrays. At 99% requested coverage with only 19 calibration scores, k = ceil(20 × 0.99) = 20, so this construction yields an unbounded interval. Taking the largest observed residual instead does not provide the requested distribution-free 99% guarantee.

3. Explain the guarantee without overselling it

Under exchangeability, the next score's rank among the calibration scores and itself supports the finite-sample coverage bound. The claim averages over calibration and test data; it is not a promise that every realized calibration set yields exactly 90% population coverage, or that each specific job has a 90% conditional probability of being covered. Ties can make the deterministic interval conservative.

As an original counterexample to overinterpreting the metric, suppose 90% of jobs are easy and their intervals always cover, while the remaining 10% are difficult and their intervals never cover. Overall coverage is 90%, yet difficult-job coverage is zero. A passing marginal metric alone cannot justify a per-customer or per-SKU service promise.

Measure subgroup coverage with uncertainty and sufficient samples. Predefined group-specific calibration can target coverage within those groups when exchangeability holds inside each group, but it consumes calibration data and does not establish coverage conditional on every possible input. Choosing groups after examining failures needs fresh validation.

4. Make width respond to predictable difficulty

A fixed residual threshold gives every job the same half-width. To adapt, train a positive scale predictor g(x) on training data and use score |y − f(x)|/g(x). After calibrating its threshold q, return f(x) ± qg(x). Floor the scale away from zero using a rule fixed before calibration.

If calibrated q is 2, a job with f(x) = 12 and g(x) = 0.5 gets [11, 13], while another with the same point prediction and g(x) = 3 gets [6, 18]. These are separate illustrative values, not a transformation of the earlier 19 residuals. Better scale prediction can improve usefulness, but normalized scores must be calibrated anew. A poor scale model can create uneven widths while marginal validity still depends on the same assumptions.

For classification, a simple score is 1 − p(y|x). If its separately calibrated threshold is 0.70, include labels with p(y|x) ≥ 0.30. For probabilities (0.55, 0.35, 0.10), the set contains the first two labels. Set coverage asks whether the true label is included; it is not top-one accuracy. Empty or large sets need an explicit product behavior.

5. Show why distribution shift matters

Suppose a future customer introduces a workload on which every absolute residual is four minutes. The earlier q = 3 intervals cover none of those jobs. Nothing in the old calibration table prevents this changed population. The original exchangeability assumption no longer applies, so “distribution free” does not mean “valid under arbitrary distribution shift.”

Monitor interval width, coverage on matured labels and customer/time slices. Recalibrate on a representative new cohort after checking why errors changed. A rolling window may be a useful adaptation, but basic split-conformal coverage does not automatically follow for dependent or drifting time-series data. Use a method whose assumptions and guarantee match that setting, and communicate the difference.

Labels arriving only when jobs finish create another trap: excluding still-running jobs systematically removes long durations. Define a cohort with adequate follow-up, or use a method designed for censoring. Silently treating unfinished jobs as missing at random can make intervals appear narrower and better covered than they are.

6. Keep calibration separate from model selection

Use training and validation data to choose features, model, score function and operational policy. Reserve calibration data for the final frozen construction, then use independent evaluation data to inspect coverage and width. Version the model, preprocessing, scale rule, calibration population, α and q together. Updating any of these components may require recalibration.

When comparing methods, report average and tail interval widths or set sizes alongside overall and slice coverage. Do not select the narrowest of many calibrated candidates using the same calibration labels and assume the original bound survives unchanged. Repeatedly tuning until an evaluation slice passes also turns the evaluation set into development data.

If the product only displays narrow intervals and suppresses wide ones, its displayed subset can have different coverage. Evaluate that selection policy explicitly. An abstention rule or a user filter is part of the deployed system, not a harmless presentation detail.

7. Follow-ups and self-review

Follow-ups: Why n + 1 in the rank? The rank argument includes the next score as well as n calibration scores. Why not use calibration residuals from training examples? Training-specific fit can make them unrepresentative of a new score. Does 90% coverage mean nine of the next ten jobs must be covered? No: it is a probability statement under assumptions, not an exact block quota. Can all-real-line intervals be valid? Yes, but they are uninformative.

Score 0–2 each for defining exchangeability and data splits, obtaining the correct finite-sample rank, distinguishing prediction from mean confidence intervals, recognizing marginal versus conditional coverage, and handling shift and operational selection. A strong answer includes both a numerical interval and a precise statement of what it does not guarantee.

Sources and next steps

The job residuals, rank exercises, subgroup counterexample and deployment workflow are original worked practice. Continue with confidence intervals and survival analysis.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.