Based on the AIF-C01 exam guideReport an error
AIF-C01 doesn't ask you to memorize complex formulas. It asks for the intuition of "what does precision care about, and what does recall care about?" For example, think of a model that judges "Is this email spam?"
| Actual \ Predicted | Predicted spam | Predicted normal |
|---|---|---|
| Actually spam | True Positive (TP) ✅ Correctly caught | False Negative (FN) ❌ Missed |
| Actually normal | False Positive (FP) ❌ Wrongly caught | True Negative (TN) ✅ Correctly passed |
This 2×2 table is called a Confusion Matrix. Accuracy, precision, and recall are all calculated from the numbers in these four cells. You don't need to memorize the table, but a feel for the difference between "wrongly catching (FP)" and "missing (FN)" matters on the exam and in practice alike.
📚 Example: Precision matters in a spam filter. If an important work email is wrongly classified as spam (FP), it is a big problem. The precision-centric way of thinking is "if we caught it, it must definitely be spam."
📚 Example: Recall is decisive in a cancer diagnosis model. Missing a patient who really has cancer (FN) is life-threatening. Suspecting a healthy person and sending them for additional tests (FP) is far less critical. The recall-centric way of thinking is "we must never miss a real case."
| Metric | One-line definition | What it fears | When it matters |
|---|---|---|---|
| Precision | Real proportion among what we caught | False alarms (FP) | Spam filters, cases where wrong alerts are costly |
| Recall | Proportion we caught out of what's real | Misses (FN) | Cancer diagnosis, fraud detection, cases where a miss is critical |
The F1 score is the harmonic mean of precision and recall, summarizing the balance between them in one value. For the exam, it is enough to know that "the metric that considers precision and recall together is F1." Which metric to prioritize is decided by the business question: "which mistake is more critical?"
Suppose 1,000 emails (100 actual spam, 900 normal) are fed into a spam filter. It flags 90 emails as spam, and 80 of them are real spam.
| Actual \ Predicted | Predicted spam | Predicted normal | Total |
|---|---|---|---|
| Actually spam | TP 80 | FN 20 | 100 |
| Actually normal | FP 10 | TN 890 | 900 |
| Total | 90 | 910 | 1,000 |
| Metric | How to read it | Calculation | Value |
|---|---|---|---|
| Accuracy | Correct ones out of all | (80 + 890) ÷ 1,000 | 97.0% |
| Precision | Look at the predicted column: real spam among the 90 caught | 80 ÷ 90 | about 88.9% |
| Recall | Look at the actual row: caught ones among the 100 real spam | 80 ÷ 100 | 80.0% |
| F1 score | Harmonic mean of precision and recall | 2 × 80 ÷ (2 × 80 + 10 + 20) | about 84.2% |
A model usually outputs a score such as "X% likelihood of being spam," and a person decides from what percentage upward to flag something as spam. With the same model and the same 1,000 emails, we recalculate by changing only this threshold.
| Threshold | Number flagged as spam | TP | FP | FN | Precision | Recall |
|---|---|---|---|---|---|---|
| Strict (flag only when sure) | 60 | 58 | 2 | 42 | about 96.7% | 58.0% |
| Middle | 90 | 80 | 10 | 20 | about 88.9% | 80.0% |
| Loose (flag on the slightest suspicion) | 200 | 95 | 105 | 5 | 47.5% | 95.0% |
Take yesterday's fraud detection example (10 fraud cases among 10,000 transactions). Put a model that answers "everything is normal" into the four cells: TP 0, FP 0, FN 10, TN 9,990.
The advice that for problems of finding rare targets you should look at recall, precision, and F1 instead of accuracy comes from this calculation.
First decide what the "positive" is. Positive does not mean good; it means the target the model is trying to find. In cancer diagnosis, "has cancer" is the positive.
| Scenario | More expensive mistake | Priority metric |
|---|---|---|
| A spam filter where important work email must not land in the spam folder | False alarm (FP) | Precision |
| A disease screening test where patients must not be missed | Miss (FN) | Recall |
| A detection system that must catch fraudulent transactions as completely as possible | Miss (FN) | Recall |
| Security screening where dangerous items must not get through | Miss (FN) | Recall |
| A video classifier that attaches a "safe for children" label | False alarm (FP) — a harmful video labeled safe | Precision |
| Selecting recipients of a high-value coupon that costs a lot for every one sent | False alarm (FP) — sending to people who won't respond | Precision |
| Positive cases are rare and both mistakes are burdensome | Both | F1 score |
| The two categories have similar proportions and the cost of mistakes is similar | No distinction | Accuracy is enough |
The exam guide divides the yardsticks for evaluating a model into two groups.
| Group | Examples | Question it answers |
|---|---|---|
| Model performance metrics | Accuracy, precision, recall, F1 score | "How well does the model get things right?" |
| Business metrics | Cost per user, development cost, customer feedback, return on investment (ROI) | "So is it profitable for the business?" |
A good model applies the patterns learned from training data well to unseen data too. This ability is generalization.
| Symptom | What happened | Analogy |
|---|---|---|
| Underfitting | Failed to learn properly even from the training data | Didn't study enough and got every test question wrong |
| Overfitting | Memorized the training data wholesale | Memorized the answer key; weak on new questions |
[ Analogy of drawing a line through data ]
Underfitting Proper (good generalization) Overfitting
───── ~~~~ ∿∿∿∿∿∿
One straight Smooth curve that Forcing the line through
line passes follows the trend every single point
roughly well (memorizing noise)
(too simple) (just right)
The easiest signal for diagnosing overfitting is a large gap: "a very high training score but a low test score." Conversely, with underfitting both the training score and the test score are low. Ways to reduce overfitting include obtaining more data, simplifying the model, and regularization; at exam level, remembering that "more and more diverse data helps" is enough.
🎯 Scenario: "A model has 99% accuracy on training data and 62% accuracy on test data. What happened?" → The gap between the training and test scores is large, so it is overfitting. It is a sign that the model merely memorized the training data and failed to generalize.
Tomorrow we cover the human role in all of this — data labeling, feedback, and iterative improvement. ML never runs without people.
Click a choice to reveal the answer and explanation.
Question 1
For a spam filter where it is most important to reduce mistakes that misclassify legitimate email as spam, which metric should be raised first?
Question 2
In a cancer diagnosis model, missing an actual cancer patient is the most critical failure. Which metric should be raised first?
Question 3
A model shows 99% accuracy on the training data, but its accuracy drops sharply to 60% on unseen test data. What is the problem with this model?
Question 4
Which metric summarizes precision and recall into a single balanced value?
Question 5
What is it called when a model is too simple and performs poorly on both the training data and the test data?