Skip to content
Tech Interview Prep
Technical interview guide

Model Evaluation Metrics

Picking the right metric (accuracy, precision/recall, F1, ROC-AUC) for the problem and its class balance.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v7
Editorial status
Reviewed

Scope: scikit-learn stable model-evaluation, calibration, and cross-validation guidance and Google ML Crash Course classification, fairness, and monitoring guidance accessed 2026-08-31..

Overview

Curated: · Written: · Reviewed:

Model Evaluation Metrics

In one line

Choose the metric from the decision: the error costs, the class balance, the action that consumes the score, and the review capacity. Use ROC AUC to judge ranking, log loss or Brier score to judge probabilities, and precision and recall at a declared threshold to judge the decision.

Key definitions

  • Precision: TP / (TP + FP), the share of flags that are real fraud.
  • Recall (TPR): TP / (TP + FN), the share of real positives caught.
  • FPR: FP / (FP + TN), the share of legitimate cases flagged.
  • Prevalence: positives / N. It sets the precision baseline and the meaning of every precision number.
  • Calibration: among cases scored p, the observed positive rate is p.
  • Macro vs weighted average: macro gives each class equal weight; weighted follows class support.

Formulas and complexity

Accuracy=TP+TNN,Precision=TPTP+FP,Recall=TPTP+FN\text{Accuracy}=\frac{TP+TN}{N}, \qquad \text{Precision}=\frac{TP}{TP+FP}, \qquad \text{Recall}=\frac{TP}{TP+FN} Brier=1N∑i=1N(pi−yi)2,LogLoss=−1N∑i=1N[yilog⁡pi+(1−yi)log⁡(1−pi)]\text{Brier}=\frac{1}{N}\sum_{i=1}^{N}(p_i-y_i)^2, \qquad \text{LogLoss}=-\frac{1}{N}\sum_{i=1}^{N}\left[y_i\log p_i+(1-y_i)\log(1-p_i)\right] Lτ(y,q)=max⁡(τ(y−q), (τ−1)(y−q))L_\tau(y,q)=\max\big(\tau(y-q),\,(\tau-1)(y-q)\big) ROC AUC=P(scorepos>scoreneg),random AP≈prevalence\text{ROC AUC}=P(\text{score}_{\text{pos}}>\text{score}_{\text{neg}}), \qquad \text{random AP}\approx\text{prevalence} R2=1−∑(yi−y^i)2∑(yi−yˉ)2R^2=1-\frac{\sum(y_i-\hat{y}_i)^2}{\sum(y_i-\bar{y})^2}

How it works

The model emits a score. A threshold turns each score into a flag, which splits the set into four counts. Precision, FPR and alert volume come from the flagged side. Recall and missed-fraud cost come from the unflagged side. Moving the threshold moves cases between sides, and only the ranking stays fixed. AUC summarizes every threshold at once, so it cannot tell you which one to ship.

Model score Threshold Flagged: TP and FP Not flagged: TN and FN Precision, FPR, alert volume Recall, missed-fraud cost Cost and capacity check

When to use and when not to

MetricUse whenAvoid when
AccuracyClasses are roughly balanced and errors cost the samePrevalence is low; an all-negative model scores high
Precision and recallA specific threshold will drive an actionYou still need to pick the threshold
ROC AUCYou compare rankings across modelsPositives are rare and you need alert volume
PR curve and average precisionPositives are rare; precision mattersYou compare populations with different prevalence
Log loss, BrierScores feed expected-cost decisionsThe scores are only ranked, never used as probabilities
MAE, RMSEError is in target units; MAE for linear cost, RMSE for large-miss penaltiesTargets are near zero (MAPE breaks)

Traps interviewers probe

  1. Accuracy at low prevalence. At 0.5% fraud, a model that flags nothing scores 99.5%. Fix: report confusion counts, precision and recall. In MCQ 1, 99.35% accuracy hides 900 missed frauds and 10% recall.
  2. Reading AUC as the operating point. AUC is identical at every threshold. Fix: fix the threshold from costs and review capacity, then report precision, recall and alert count there.
  3. Random splits on repeated entities. Shuffled CV puts one patient in both train and test, which inflates AUC. Fix: split by patient, then compare to a holdout of unseen patients.
  4. Calibrating and scoring on the same rows. An isotonic fit on a set and re-measured on that set looks perfect and then fails on fresh data. Fix: fit calibration on one fold, measure on another.
  5. Reporting the best of many variants. The maximum of 50 noisy test accuracies overstates the expected accuracy. Fix: report the chosen model's score once on a locked test set, with an interval.

Interview tips

Open with the decision. Start with "What action consumes the score, what does each error cost, and how many alerts can we handle?" Then name the metric. Do not open with a metric name.

Expect these follow-ups:

  • Why does AUC look good while alerts overwhelm the team? Rare positives make a small FPR produce many false positives.
  • How do you set the threshold? Minimize expected cost on a validation set, subject to review capacity, then test once.
  • What changes when prevalence falls? Precision falls with the same scores and the same AUC (MCQ 24).
  • Why is a lower Brier score not always better? It can improve through sharper, better-ranked predictions while calibration worsens (MCQ 10).
  • How wide is the uncertainty? Bootstrap the eval set; small slices give wide intervals (MCQ 22).

30-second answer outline:

  1. Name the action and the costs: "A missed fraud costs $500, a false alarm $8."
  2. Name the metric for the decision: expected cost and alert volume at the threshold.
  3. Name the ranking and calibration checks: AUC and reliability on a grouped holdout.
  4. Name the guardrails: per-cohort recall, prevalence assumptions, and the single locked test run.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.