AIF-C01 · Fundamentals of AI and ML · Updated July 26, 2026
Accuracy, Precision, Recall, F1, and AUC: Choosing the Right Model Evaluation Metric
Precision measures how many of a model’s positive predictions were actually correct, recall measures how many of the real positives the model managed to catch, and the F1 score is the harmonic mean that balances the two. Accuracy — the fraction of all predictions that were right — is only trustworthy when classes are roughly balanced and all mistakes cost about the same. Choosing among these metrics is not a math exercise; it is a business decision about which kind of error your application can least afford.
The confusion matrix: where every metric starts
Every classification metric is built from four counts, arranged in what is called a confusion matrix:
- True positive (TP) — the model said positive, and it was positive.
- True negative (TN) — the model said negative, and it was negative.
- False positive (FP) — the model said positive, but it was negative (a false alarm).
- False negative (FN) — the model said negative, but it was positive (a miss).
From these four numbers:
- Accuracy = (TP + TN) / all predictions — overall correctness.
- Precision = TP / (TP + FP) — when the model flags something, how often is it right?
- Recall = TP / (TP + FN) — of everything that should have been flagged, how much did the model find? (Also called sensitivity or true positive rate.)
- F1 score = 2 × (precision × recall) / (precision + recall) — a single number that is only high when both precision and recall are high.
Why accuracy fails on imbalanced data
Imagine a disease-screening dataset where only 2% of cases are positive. A useless model that predicts “negative” for every single patient scores 98% accuracy while catching zero sick patients. The headline number looks excellent precisely because the rare class — the one you actually care about — barely moves it.
This is the single most-tested idea in this topic: on imbalanced datasets, accuracy is misleading, and metrics that account for the minority class — F1 score or area under the ROC curve (AUC) — give a truer picture. The ROC curve plots true positive rate against false positive rate across every possible decision threshold; AUC summarizes it as one number between 0.5 (random guessing) and 1.0 (perfect separation). Because AUC evaluates ranking quality across thresholds rather than raw correctness at one threshold, it is far harder to inflate with a do-nothing majority-class model.
Accuracy still has a legitimate home: multi-class problems with reasonably balanced categories and symmetric error costs. If you are routing support tickets into five categories and no single misroute is catastrophic, “how often does the model pick the correct category overall” — plain accuracy — is exactly the right question.
Precision vs recall: which error hurts more?
Precision and recall pull against each other. Tighten a model’s threshold and it flags less, raising precision but missing more true cases (lower recall); loosen it and recall climbs while false alarms multiply. The right trade-off depends entirely on the cost of each error type.
| Optimize precision | Optimize recall | |
|---|---|---|
| Question answered | ”When we flag something, are we right?" | "Did we catch everything real?” |
| Error minimized | False positives (false alarms) | False negatives (misses) |
| Typical scenarios | Spam filters (never bury a real email), content takedowns, fraud actions that freeze accounts | Medical screening, safety inspections, security threat detection |
| Cost profile | Acting on a false alarm is expensive or harmful | Missing a true case is expensive or dangerous |
Two anchor scenarios worth internalizing:
- Medical imaging: a missed tumor (false negative) can cost a life, while a false alarm costs a follow-up test. Compare candidate models primarily on recall — and accept the extra false positives that come with it.
- Spam detection: users tolerate a little spam in the inbox far better than a legitimate contract vanishing into the junk folder, yet a filter that catches nothing is useless. You need both qualities, which is exactly what the F1 score was designed to summarize in one number.
Because F1 uses the harmonic mean rather than a simple average, a model cannot buy a good F1 by maxing one metric and ignoring the other — precision 1.0 with recall 0.02 yields an F1 near 0.04, not near 0.5. That property is why F1 is the default headline metric for imbalanced binary classification.
Evaluation in the ML lifecycle on AWS
Metric selection happens during the evaluation stage of the machine learning (ML) development lifecycle, using a held-out test set the model never saw in training — a healthy validation-vs-training comparison also guards against the failure modes covered in overfitting vs underfitting. On AWS, Amazon SageMaker surfaces these metrics throughout the workflow: training jobs and SageMaker Canvas report accuracy, precision, recall, F1, and AUC for classification models; SageMaker Clarify adds bias and explainability reporting alongside them; and SageMaker Model Cards give you a governed place to record which metric you chose, the scores achieved, and why that metric fit the business problem. Note that these metrics apply to classification; regression models use different measures (such as mean squared error), and generative text models use others still (such as ROUGE or BLEU).
How the AIF-C01 exam tests this
- The imbalanced-dataset trap. A stem describes a rare positive class — 2% disease prevalence, rare fraud — and asks why AUC or F1 beats accuracy, or which metric to prefer. The answer always turns on accuracy being inflated by the dominant majority class.
- “Which single metric balances both?” A scenario needs to catch true positives and avoid false alarms (spam is the classic setup), and asks for one metric summarizing the balance. That is the F1 score, by definition.
- Cost-of-error prioritization. The stem states that one error type is more dangerous — usually false negatives in a medical or safety context — and asks which evaluation approach fits. Map “missing a positive is unacceptable” to prioritizing recall; map “false alarms are unacceptable” to prioritizing precision.
- When plain accuracy is right. A balanced multi-class task (“classify tickets into five categories, measure overall correctness”) where the straightforward answer — accuracy — is correct. Don’t overthink these; the exam rewards matching the metric to the stated question, not reflexively picking the fanciest option.
Evaluation metrics appear across several domains, so it’s worth seeing how they fit into the full AIF-C01 study guide — and worth drilling with practice questions until the precision-versus-recall call is automatic.
Quick reference
- Accuracy = overall fraction correct; trustworthy only with balanced classes and symmetric error costs.
- Precision = TP / (TP + FP): of everything flagged, how much was real. High precision = few false alarms.
- Recall = TP / (TP + FN): of everything real, how much was caught. High recall = few misses.
- F1 = harmonic mean of precision and recall; the go-to single metric for imbalanced binary classification.
- AUC measures ranking quality across all thresholds; 0.5 is random, 1.0 is perfect.
- Rare positive class → distrust accuracy, reach for F1 or AUC.
- False negatives costly (medical, safety) → prioritize recall; false positives costly → prioritize precision.
- SageMaker reports these metrics at evaluation time; SageMaker Model Cards document the choice for governance.