On this page
Imagine a school screens 1,000 students for a condition that 20 of them have. The test catches 18 of the 20 and wrongly flags 49 healthy students. Is that a good test? That depends on which mistake you care about. The numbers are made up for teaching; the method is the one in Google's Machine Learning Crash Course, and it works the same for an AI model as for a blood test.
What is accuracy, and why can it mislead?
Accuracy is "the proportion of all classifications that were correct, whether positive or negative", as Google's Machine Learning Crash Course defines it. Our test is right about 18 sick students and 931 healthy ones, so its accuracy is (18 + 931) ÷ 1,000 = 94.9%.
Now meet a lazy test that tells every student "you're fine". It is right about all 980 healthy students, so its accuracy is 98%, higher than the real test, though it never finds a single case. Google's course makes the same point: when one class appears 1% of the time, a model that always predicts negative "would score 99% on accuracy, despite being useless".
Accuracy hides two different mistakes. Sort every prediction into four boxes:
True positive (TP): sick, and the test says sick: 18.
False negative (FN): sick, but the test says healthy: 2.
False positive (FP): healthy, but the test says sick: 49.
True negative (TN): healthy, and the test says healthy: 931.
What is the difference between precision and recall?
Recall is TP ÷ (TP + FN): of all the real cases, how many did the model find? That is the formula in Google's crash course. Doctors call it sensitivity, which Azeem Majeed, Professor of Primary Care and Public Health at Imperial College London, defines as "the proportion of people with a disease who test positive" on a diagnostic or screening test (Imperial College London).
Precision is TP ÷ (TP + FP): of everything the model flagged, how much was really positive? Medicine calls it positive predictive value.
Our test has recall = 18 ÷ 20 = 90%, but precision = 18 ÷ (18 + 49) = 26.9%. When it says "positive", it is wrong nearly three times out of four, because healthy students vastly outnumber sick ones. Majeed's guide notes that positive predictive value "depends on the prevalence of the disease in the population being tested", with a COVID-19 test example of 90% sensitivity and 98% specificity whose positive predictive value falls from 70% at 5% prevalence to 31% at 1% (Imperial College London). This is Bayes' theorem at work; see our three-step method for conditional probability and Bayes' theorem.
Real screening results are usually followed by further tests; a doctor can explain what one means for you.
How does a spam filter show the trade-off?
Say 1,000 emails arrive: 200 spam and 800 real. Two filters, scored with the formulas from Google's crash course:
Filter A (cautious) moves 150 emails to spam: 147 are spam and 3 are real. Precision = 147 ÷ 150 = 98%. Recall = 147 ÷ 200 = 73.5%. Accuracy = (147 + 797) ÷ 1,000 = 94.4%.
Filter B (eager) moves 250 emails to spam: 195 are spam and 55 are real. Precision = 195 ÷ 250 = 78%. Recall = 195 ÷ 200 = 97.5%. Accuracy = (195 + 745) ÷ 1,000 = 94.0%.
Almost identical accuracy, very different experience. With Filter A, 53 spam emails still reach your inbox. With Filter B, 55 real emails vanish into spam, and one might be your exam admit card. Google's course explains why you rarely get both: precision and recall "often show an inverse relationship, where improving one of them worsens the other" as the decision threshold moves.
One number that balances both is the F1 score, the harmonic mean of precision and recall, where 1 is best and 0 worst (scikit-learn documentation). Filter A scores about 0.84, Filter B about 0.87.
Which matters more: precision or recall?
Ask one question: which mistake costs more?
Missing a real case is worse, so favour recall: first-round disease screening, a gas-leak alarm.
A false alarm is worse, so favour precision: a spam filter that might hide important mail, or an AI-writing detector accusing an honest student (see why AI-writing detectors misfire).
Both matter equally, so report both numbers, or F1.
How do you check a "95% accurate" claim?
When someone quotes one accuracy figure, sort it into the four boxes from Google's crash course and ask:
How common is the thing being detected? If it is rare, accuracy tells you little.
What are precision and recall, separately?
Who pays for each mistake, and which number covers it?
Would a lazy model that always says no score almost as high?
The same habit works on your own results: read mock test accuracy alongside time and question type.
If the conditional probability underneath feels shaky, the Fermi Concept Library gives each mathematics concept its own lesson, and Fermi's AI tutor can work out what you already know and build a plan for the session, so you start from the right gap.



