Skip to content

Evaluation Metrics Interview FAQ

Choose the right metric for your problem

Understanding evaluation metrics is critical for any ML interview. Choosing the wrong metric can lead to models that perform well on paper but fail in production.


Quick Navigation

SectionTopics CoveredDifficulty
Classification MetricsAccuracy, Precision, Recall, F1, AUCFundamental
Precision vs RecallWhen to prioritize which metricIntermediate
ROC vs PR CurvesCurve comparison and interpretationIntermediate
Regression MetricsMSE, RMSE, MAE, R-squared, MAPEFundamental
MAE vs RMSEWhen to use which error metricIntermediate
Ranking MetricsNDCG, MAP, MRRAdvanced
Imbalanced DataHandling class imbalanceIntermediate
Micro vs Macro AveragingMulti-class metric aggregationIntermediate
CalibrationProbability calibration metricsAdvanced

Classification Metrics

Q1: What is accuracy and when should you NOT use it?

Accuracy = (TP + TN) / Total

When NOT to use:

  • Imbalanced datasets: 99% negative class means "always negative" gets 99% accuracy
  • Different error costs: Missing cancer (FN) vs false alarm (FP)
  • Rare event detection: Fraud, anomalies, rare diseases

Q2: Explain Precision and Recall with examples.

Confusion Matrix with Classification Metrics

Precision = TP / (TP + FP) - "When I predict positive, am I right?"

Recall = TP / (TP + FN) - "Did I find all the positives?"

MetricExample
Precision90 of 100 flagged spam emails were actually spam = 90%
RecallCaught 80 of 100 actual spam emails = 80%

Q3: What is the F1 Score and why use it?

F1 Score is the harmonic mean of precision and recall:

F1=2PrecisionRecallPrecision+Recall

Why harmonic mean? It penalizes extreme imbalances:

PrecisionRecallArithmetic MeanF1 (Harmonic)
1.00.00.50.0
0.90.10.50.18
0.70.70.70.7

F-beta Score: Generalizes F1 with configurable weighting:

  • F0.5: Weights precision higher (FP cost > FN)
  • F2: Weights recall higher (FN cost > FP)

Q4: What is AUC-ROC and how do you interpret it?

ROC Curve with AUC

ROC Curve plots TPR (Recall) vs FPR at all thresholds. AUC-ROC = Area Under Curve.

AUC ValueMeaning
0.5Random guessing
0.7-0.8Acceptable
0.8-0.9Good
0.9+Excellent

Probabilistic Interpretation: AUC = P(random positive scored higher than random negative)


Q5: What is AUC-PR and when should you use it?

Precision-Recall Curve with Iso-F1 Curves

PR Curve plots Precision vs Recall. The iso-F1 curves show constant F1 score contours.

AspectROC CurvePR Curve
Uses TNYes (in FPR)No
Class imbalanceLess sensitiveDirectly reflects it
BaselineDiagonal (0.5)Positive class %
Best forBalancedImbalanced

Rule: Use PR-AUC when positive class is rare.


Q6: What is Log Loss?

Log Loss (Cross-Entropy) measures quality of predicted probabilities:

Log Loss=1Ni=1N[yilog(pi)+(1yi)log(1pi)]

Key Properties:

  • Range: 0 to infinity (lower is better)
  • Penalizes confident wrong predictions severely
  • Requires probability outputs (not just hard labels)

Use when: Confidence of predictions matters, not just correctness.


Precision vs Recall Deep Dive

Threshold vs Metrics

The visualization above shows how precision, recall, and F1 change with classification threshold.

Q7: When should you prioritize Precision?

Prioritize Precision when FP costly: Spam filtering, drug recommendations, automated blocking, alert systems.


Q8: When should you prioritize Recall?

Prioritize Recall when FN costly: Cancer screening, fraud detection, security threats, manufacturing defects.


Q9: How do you choose in practice?

  1. Quantify error costs with stakeholders
  2. Calculate cost ratio: Cost(FN) / Cost(FP)
  3. Choose threshold from the metrics curve above
Cost RatioStrategy
FN >> FPLow threshold (high recall zone)
FP >> FNHigh threshold (high precision zone)
FN = FPOptimal F1 threshold

ROC vs Precision-Recall Curves

Q10: Compare ROC and PR curves.

See the ROC and PR curve visualizations in Q4 and Q5 above.

AspectROC CurvePR Curve
AxesTPR vs FPRPrecision vs Recall
Random baselineDiagonal (AUC=0.5)Horizontal at positive %
Perfect classifierTop-left cornerTop-right corner
Imbalanced dataCan be overly optimisticMore informative

Example on imbalanced data (1% positive): Same model: ROC-AUC=0.95 (looks great!) vs PR-AUC=0.30 (reveals truth).

Interview Tip: ROC misleads for imbalanced data because large TN inflates FPR denominator.


Regression Metrics

Q11: Explain MSE and RMSE.

MSE: MSE=1n(yiy^i)2

RMSE: RMSE=MSE

PropertyMSERMSE
UnitsSquaredSame as target
Outlier sensitivityVery highHigh
InterpretabilityHarderEasier

Why square errors? Makes all positive, penalizes large errors, differentiable everywhere.


Q12: Explain MAE and when to prefer it.

MAE: MAE=1n|yiy^i|

AspectMAERMSE
Outlier sensitivityRobustSensitive
Error weightingEqualLarge errors weighted more
Interpretation"Average error""Typical error"

Key Relationship: MAE <= RMSE. If RMSE >> MAE, there are outliers.


Q13: What is R-squared and its limitations?

R-squared: R2=1SSresSStot

Proportion of variance explained by the model (0 to 1, can be negative).

Limitations (critical for interviews):

LimitationExplanation
Always increases with featuresAdding noise still increases R-squared
Doesn't indicate causationHigh R-squared != good causal model
Scale-dependentCan't compare across datasets
Can be negativeWhen worse than mean baseline

Adjusted R-squared penalizes adding unhelpful features.


Q14: What is MAPE?

MAPE: MAPE=100%n|yiy^iyi|

AdvantageLimitation
Scale-independentDivision by zero when y=0
Easy to interpretAsymmetric (penalizes over-predictions more)
Comparable across datasetsBiased toward under-predictions

MAE vs RMSE Deep Dive

Q15: When should you use MAE vs RMSE?

Use MAE WhenUse RMSE When
Outliers presentData is clean
All errors matter equallyLarge errors especially bad
Robust estimate neededStatistical properties important
Business cares about average errorBusiness cares about worst-case

Practical Examples:

ScenarioBetter MetricReasoning
House pricesMAELuxury homes are outliers
Weather forecastRMSELarge errors are dangerous
Stock returnsMAEOutliers common
ManufacturingRMSELarge deviations cause issues

Q16: How do outliers affect MAE vs RMSE?

Errors: [10, 10, 10, 10, 50] (one outlier)

MetricResultOutlier Contribution
MAE1856% of total
RMSE24.186% of total

Key Insight: RMSE is disproportionately affected by outliers due to squaring.


Ranking Metrics

Q17: What is NDCG?

NDCG (Normalized Discounted Cumulative Gain) measures ranking quality with position discounting.

DCG: DCGk=i=1krelilog2(i+1)

NDCG: NDCGk=DCGkIDCGk (normalized by ideal ranking)

PropertyValue
Range0 to 1
Perfect ranking1.0
Position-awareYes (log discount)
Graded relevanceYes

Q18: What is Mean Average Precision (MAP)?

AP for one query: Average of precision values at positions where relevant items appear.

AP=1|R|k=1nP(k)rel(k)

MAP: Mean of AP across all queries.

Example: Results [1, 0, 1, 0, 1] (1=relevant)

PositionP@kContribution
11.01.0
30.670.67
50.60.6

AP = (1.0 + 0.67 + 0.6) / 3 = 0.76


Q19: What is MRR?

MRR (Mean Reciprocal Rank): Average of 1/rank of first relevant result.

MRR=1|Q|i=1|Q|1ranki

Use when: Only the first relevant result matters (Q&A systems).

Ranking Metrics Comparison:

MetricPosition DiscountGraded RelevanceUse Case
NDCGLogarithmicYesGeneral ranking
MAPLinear (via AP)No (binary)Document retrieval
MRROnly firstNoFirst-result focused

Metrics for Imbalanced Data

Q20: Why is accuracy misleading for imbalanced data?

Fraud detection with 0.1% fraud rate:

ModelStrategyAccuracyRecall
AAlways "not fraud"99.9%0%
BActual ML model98%70%

Model A has higher accuracy but is useless.

Better Metrics:

  • Precision, Recall, F1
  • PR-AUC
  • Balanced Accuracy
  • Cohen's Kappa

Q21: What is Balanced Accuracy?

Balanced Accuracy=TPR+TNR2

Gives equal weight to each class regardless of size. Random classifier achieves 0.5.


Q22: What is Cohen's Kappa?

κ=pope1pe

Measures agreement beyond chance.

KappaAgreement Level
0.0 - 0.2Slight
0.4 - 0.6Moderate
0.8 - 1.0Almost perfect

Micro vs Macro Averaging

Q23: Explain Micro vs Macro averaging.

Macro: Calculate metric per class, then average (equal weight per class).

Micro: Aggregate TP/FP/FN across classes, then calculate (weight by frequency).

AspectMacroMicro
Class weightingEqual per classBy frequency
Small class impactHighLow
When to useAll classes equally importantOverall performance

Example:

ClassSizeF1
A10000.96
B1000.75
C100.44
  • Macro-F1 = 0.72
  • Micro-F1 = ~0.94 (dominated by class A)

Q24: When to use each?

Use Macro: All classes equally important, rare classes matter, fairness required.

Use Micro: Overall performance matters, balanced classes, per-instance importance.


Calibration and Brier Score

Q25: What is probability calibration?

Calibration Plot (Reliability Diagram)

A well-calibrated model's predicted 70% means actual 70% frequency. The reliability diagram above shows how different models can be overconfident, under-confident, or well-calibrated.

Why It Matters: Medical diagnosis (risk must be accurate), insurance pricing, ensemble methods.


Q26: What is the Brier Score?

Brier Score=1N(piyi)2
PropertyValue
Range0 to 1 (lower is better)
Perfect0
Random baseline0.25

vs Log Loss: Brier is bounded (0-1) and penalizes extreme predictions less.


Q27: How do you measure calibration?

Reliability Diagram: Plot predicted vs actual probability (see visualization above). Perfect = diagonal.

Expected Calibration Error (ECE): Weighted average of calibration error per bin.

Calibration Methods: Platt Scaling, Temperature Scaling, Isotonic Regression.


Quick Reference Tables

Classification Metrics

MetricFormulaBest For
Accuracy(TP+TN)/TotalBalanced classes
PrecisionTP/(TP+FP)FP costly
RecallTP/(TP+FN)FN costly
F12PR/(P+R)Balance P and R
AUC-ROCArea under ROCBalanced classes
AUC-PRArea under PRImbalanced classes

Regression Metrics

MetricFormulaOutlier Robust
MSEmean((y-y_hat)^2)No
RMSEsqrt(MSE)No
MAEmean(abs(y-y_hat))Yes
R-squared1 - SS_res/SS_totNo
MAPEmean(abs((y-y_hat)/y))Somewhat

Ranking Metrics

MetricPosition AwareGraded Relevance
NDCGYes (log discount)Yes
MAPYes (via AP)No
MRROnly firstNo

Metric Selection Guide

ProblemClass BalanceConcernRecommended
BinaryBalancedOverallAccuracy, F1
BinaryImbalancedDetect positivesRecall, PR-AUC
BinaryImbalancedConfident positivesPrecision
Multi-classBalancedOverallMicro-F1
Multi-classImbalancedAll classesMacro-F1
RegressionCleanLarge errors badRMSE
RegressionOutliersRobustMAE

Common Interview Follow-ups

"95% accuracy but business says it doesn't work?"

  • Check class imbalance
  • Wrong metric (they care about recall)
  • Poor performance on key segments
  • Train-test distribution shift

"Highly imbalanced dataset?"

  • Use PR-AUC, F1, balanced accuracy
  • Resampling, class weights, threshold tuning

"When does calibration matter?"

  • When probabilities drive decisions
  • Risk scoring, medical diagnosis
  • Combining multiple models

"MAE vs RMSE?"

  • Outliers noise? Use MAE
  • Outliers signal? Use RMSE
  • Ask stakeholder what matters

Formula Cheat Sheet

CLASSIFICATION
Precision   = TP / (TP + FP)
Recall      = TP / (TP + FN)
F1          = 2 * P * R / (P + R)

REGRESSION
MSE   = (1/n) * sum((y - y_hat)^2)
RMSE  = sqrt(MSE)
MAE   = (1/n) * sum(|y - y_hat|)
R^2   = 1 - SS_res / SS_tot

RANKING
DCG@k  = sum(rel_i / log2(i + 1))
NDCG@k = DCG@k / IDCG@k
MRR    = (1/Q) * sum(1 / rank_i)

CALIBRATION
Brier = (1/N) * sum((p - y)^2)

Last updated: January 2026