Evaluation Metrics

Choosing and interpreting metrics for classification, regression and ranking so they reflect what actually matters.

Intermediate · about 6 hours · difficulty 2/5

Learn first: Logistic Regression and Linear Classifiers

A metric is a proxy for value. Picking the wrong one leads you to optimize the wrong thing, for example 99% accuracy on a dataset where 99% of cases are negative.

Classification

  • Confusion matrix: the source of everything else.
  • Precision, recall, F1: precision is how many flags are right, recall is how many positives are caught.
  • ROC AUC: threshold-free ranking quality; can look optimistic under heavy imbalance.
  • PR AUC / average precision: better for rare positives.
  • Log loss and Brier score: quality of probabilities; pair with calibration curves.
  • Macro versus weighted averages for multiclass.

Regression

  • MAE: robust, in target units. RMSE: penalizes large errors more.
  • R squared: variance explained, but not comparable across datasets.
  • MAPE: intuitive percentages, breaks near zero targets.

Ranking

Precision@k, recall@k, MAP and NDCG for search and recommendations.

Habits

Always compare against a baseline, report uncertainty, and look at errors by segment (region, device, user group). A good global metric can hide a terrible subgroup.

Good enough to move on when you can pick an appropriate metric for a given business problem and justify it in two sentences.

Key concepts

  • Confusion matrix
  • Precision, recall and F1
  • ROC AUC and PR AUC
  • Log loss and calibration
  • MAE, RMSE and R squared
  • Ranking metrics
  • Slice-based evaluation

Mini project

On the Kaggle Credit Card Fraud dataset, compare accuracy, ROC AUC, PR AUC and F1 for a logistic regression and a dummy model, and write a short note on which metric you would report to a fraud team.

Check yourself

When would you prefer PR AUC over ROC AUC, and why?

Free resources