Machine Learning Fundamentals interview question · Most asked
Which metrics would you use for a classification model, and when is accuracy misleading?
How you'd do it Asked in Machine Learning Engineer interviews
Summary
Accuracy misleads on imbalanced data: a fraud model that predicts "not fraud" every time is 99.9% accurate and useless. Use precision (of predicted positives, how many are right), recall (of real positives, how many we caught), F1, ROC-AUC or, for heavy imbalance, PR-AUC, and choose the threshold from the business cost of false positives vs false negatives.
Longer Answer
- Confusion matrix first: it shows the actual errors.
- Precision matters when false positives are costly (blocking good customers); recall when misses are costly (missed cancer, missed fraud).
- ROC-AUC measures ranking quality across thresholds; PR-AUC is more informative when positives are rare.
- Calibration (does a 0.8 score mean 80%?) matters when scores feed decisions or other systems; check with reliability curves and Brier score.
- Thresholds are a business decision: pick the point on the curve that minimises expected cost or meets a recall target.
- Regression: MAE, RMSE, MAPE, R²; ranking: NDCG, MAP.
Key Points
- Accuracy fails on imbalanced classes.
- Precision vs recall follows error costs.
- PR-AUC for rare positives; calibration for probabilities.
- Choose thresholds from business cost.
Explanation
What interviewers look for
Linking metric choice to the cost of each error type.
More Machine Learning Fundamentals questions
- Explain the bias-variance trade-off.
- Your model scored well offline but performs badly in production. What do you check?
- How do you split data for training, validation and testing, and what is cross-validation?
- What is data leakage, and how do you detect it?
- What is overfitting, and how do you prevent it?
- What is the difference between supervised, unsupervised and reinforcement learning?
- Compare decision trees, random forests and gradient boosting.
- Design a system that serves predictions from a trained model to a web application.