Model Evaluation Metrics — ML Technical Interview Questions & Answers
Accuracy, precision, recall, F1 and RMSE.
Model Evaluation Metrics
- Simple meaning: A metric is the mark you give the model. Classification: accuracy, precision, recall, F1. Regression: MAE, MSE, RMSE, R². Pick the metric that matches the job, not the one that looks biggest.
- Picture: 95 students pass, 5 fail. A dummy that always says “pass” is 95% accurate and useless for catching fails. Use recall/F1 on fail, or a confusion matrix.
- Regression picture: off by 2 marks vs off by 20. RMSE punishes big mistakes more than MAE.
- Trap: accuracy on an imbalanced sheet. Trap: quoting R² without saying what 1.0 and 0.0 mean.
Technical Interview Tip: Class job → precision/recall/F1. Number job → MAE/RMSE. Accuracy is not always enough.
Code Examples for Model Evaluation Metrics
Model Evaluation Metrics — working example
y_true = [1, 0, 1, 1, 0, 1]
y_pred = [1, 0, 0, 1, 0, 1]
correct = sum(t == p for t, p in zip(y_true, y_pred))
accuracy = correct / len(y_true)
print(correct, accuracy)
# Accuracy alone misleads on imbalanced classes — check precision/recall too.Model Evaluation Metrics — accuracy = correct / total. For imbalanced data, also report precision/recall/F1.
How to Explain Model Evaluation Metrics to an Interviewer
Accuracy trap?
Imbalanced classes Always-guess majority looks good
Name two regression metrics.
MAE RMSE R²