Accuracy, precision, recall, F1, ROC-AUC — new machine learning practitioners often report whichever metric their code prints first, without asking whether it is the right one. Choosing the wrong classification metrics can make a useless model look great, or a strong model look broken. This guide is a practical map of the main classification metrics: what each measures, when to use it, and a simple decision process for picking the right one.

The five classification metrics at a glance
| Metric | Formula | Answers | Best when |
|---|---|---|---|
| Accuracy | (TP+TN)/all | Overall share correct | Classes are balanced |
| Precision | TP/(TP+FP) | Are positive predictions trustworthy? | False alarms are costly |
| Recall | TP/(TP+FN) | Did we catch the positives? | Misses are costly |
| F1 | 2PR/(P+R) | Balance of precision & recall | Imbalanced, one number needed |
| ROC-AUC | Area under ROC | Ranking quality across thresholds | Comparing models, balanced data |
Accuracy: the tempting trap
Accuracy = (TP + TN) / total. It is intuitive and fine when your classes are roughly balanced. But on imbalanced data it lies: if 99% of cases are negative, a model that always predicts “negative” scores 99% accuracy while catching nothing.
Precision and recall: the workhorses
Precision and recall split “being correct” into two questions. Precision asks whether your positive predictions can be trusted (hurt by false positives). Recall asks whether you caught all the real positives (hurt by false negatives). They trade off as you move the decision threshold:
- Recall-first: disease screening, fraud, security — a miss is dangerous.
- Precision-first: spam filtering, content flagging — a false alarm is expensive or annoying.
F1: one number when both matter
When false positives and false negatives are roughly equally bad and you need a single score, use the F1 score — the harmonic mean of precision and recall. It only rewards models good at both, which is why it is the default for imbalanced classification. If the two errors are not equally costly, use the weighted F-beta variant.
ROC-AUC: the threshold-free view
All the metrics above are computed at one fixed threshold. ROC-AUC steps back and measures how well the model ranks positives above negatives across every threshold, as a single number from 0.5 to 1.0. Ideal for comparing models — but on very imbalanced data, prefer PR-AUC, which focuses on the rare positive class.
A simple decision process for classification metrics
1. Balanced classes? If yes, accuracy is a reasonable headline. If no, skip it.
2. One error much costlier? Missing positives worse → optimise recall. False alarms worse → optimise precision.
3. Need one balanced score? Use F1 (or F-beta to tilt).
4. Comparing models / choosing a threshold later? Use ROC-AUC (or PR-AUC if positives are rare).
See them together in Python
from sklearn.metrics import classification_report, roc_auc_score
print(classification_report(y_true, y_pred)) # precision, recall, F1 per class
print("ROC-AUC:", roc_auc_score(y_true, y_score))The scikit-learn model evaluation documentation lists every metric and its options.
Frequently asked questions
What is the most important classification metric?
Can I just report accuracy?
Why report several classification metrics at once?
Do classification metrics differ for multi-class problems?
Master the building blocks
- Confusion Matrix — the table everything is built from.
- Precision vs Recall — the core trade-off.
- F1 Score — one balanced number.
- ROC Curve & AUC — the threshold-free view.