The interview problem

Practice prompt

A classifier has high ROC AUC but poor precision in production. Explain this without contradiction and calculate an AUC with tied scores.

Original practice, not a reported company interview. All scenarios and worked numbers are illustrative. Interview date: not applicable. Sources retrieved September 30, 2026.

1. Scope and assumptions

Assume binary labels, larger scores indicating positives and half credit for ties. AUC evaluates ranking across positive-negative pairs, not calibration or utility at a chosen threshold.

2. Worked approach

Compare each positive score against each negative score: assign one for a win, one-half for a tie and zero for a loss, then average. For large datasets, use ranking rather than materializing all pairs. Define how weights and missing labels affect the population.

Choose an operating threshold using deployment prevalence and costs after evaluating ranking. A strictly increasing score transform preserves ordering and AUC but can change whether the values are meaningful probabilities. Compare subgroup performance rather than assuming a high aggregate score protects every slice.

3. Calculate the example

Positive scores are (0.9,0.5), negative scores (0.5,0.1). The four comparisons score 1,1,0.5,1, giving AUC=3.5/4=0.875. Now suppose a threshold has TPR=0.8 and FPR=0.1 with 1% prevalence among 10,000 cases: expected TP=80 and FP=990, so precision=80/1,070≈7.48%. High rank quality and low deployment precision can coexist.

4. Failure cases and trade-offs

Changing prevalence does not itself change class-conditional ROC rates, but it does change precision. Population or score-distribution changes can also change ROC behavior. Treating these different shifts as one effect obscures diagnosis.

AUC summarizes all thresholds, including unusable ones. Partial AUC or recall at a specified false-positive budget may better match the product. Precision-recall analysis is informative for rare positives, but its baseline and interpretation depend on prevalence.

5. Validate the result

Recompute the toy AUC manually, verify monotone-transform invariance and calculate the confusion matrix at the intended threshold. Report uncertainty using an appropriate independent or clustered sampling unit.

6. Interview follow-ups and self-review

What does a tied constant score yield? Can AUC improve while recall at a critical threshold worsens?

Reward tie handling, pairwise interpretation, prevalence arithmetic and separation of ranking from decisions.

Sources and related practice

Technical reference: scikit-learn.org — ROC AUC API and interpretation; pairwise example is original.

Exact publication/update date not established in this review. Retrieved September 30, 2026. This reference supports the named technical concept; the proposed workflow and examples are original, not a documented vendor implementation or interview report.

Continue with Choose thresholds using precision-recall curves; Class imbalance and decision thresholds.

Continue your preparation

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