English:Evaluating algorithms and models with metrics - AI Year 11
Introduction
Two programs flag scanned library pages for review. One flags more pages with missing text. The other sends fewer pages to a person and gets more total cases right. Which is better for the library? In this Year 11 AI enrichment course you will read a confusion matrix, compare accuracy, precision and recall, then choose a model using the costs of mistakes and the evidence from a fair test.
Give the positive class a meaning
For this fictional task, a page is positive when its scan is missing some text and needs a repeat scan. A separate check of the scans supplies the reference labels for evaluation. A true positive (TP) is a damaged scan flagged for review. A false positive (FP) is a complete scan flagged unnecessarily. A false negative (FN) is a damaged scan passed as complete. A true negative (TN) is a complete scan passed without review. The words “positive” and “negative” refer to the two labels chosen for this task.
Suppose a test set contains 20 affected scans and 80 complete ones. Model A finds 15 of the affected scans and forwards 10 complete ones. Fill all four cells before calculating a percentage. A has TP = 15 and FN = 5, which sum to the 20 known affected scans. It has FP = 10 and TN = 70, which sum to the 80 complete scans. An independent total check gives 100. Diagrams can put actual classes in rows or columns. Read the headings before locating a cell.

Use the right denominator for your question
Accuracy describes correct predictions among all test items: (TP + TN) divided by the total. Precision among flagged scans is TP divided by (TP + FP). Recall for affected scans is TP divided by (TP + FN). In plain language, precision asks how often a flag is justified; recall asks what share of the affected scans was found.
Model A has accuracy 85/100 = 85%, precision 15/25 = 60% and recall 15/20 = 75%. Model B's result on the same test set is TP = 10, FP = 2, FN = 10 and TN = 78. It has accuracy 88%, precision 10/12 ≈ 83.3% and recall 10/20 = 50%. In this comparison the greater total accuracy comes with more missed damaged scans.
A baseline that never flags a scan gets 80% accuracy and 0% recall. Precision is undefined here because there are no flagged scans. Report the empty denominator explicitly. This baseline is a useful test of whether high accuracy can be achieved simply by choosing the most frequent class.
Compare decisions with costs
Imagine that staff can inspect all 25 flags from Model A and estimate the cost of one missed scan at five units. An unnecessary review costs one unit. Count only the stated costs: Model A has 5 × 5 + 10 × 1 = 35 units. Model B has 10 × 5 + 2 × 1 = 52. On these assumptions Model A has a lower total. If the cost of a miss were one unit instead, A would cost 15 and B would cost 12. Show this sensitivity before deciding that one system is better for all libraries.
A classifier may output a score and then apply a threshold. Imagine a policy that flags scores of at least 0.60. Decreasing the threshold to 0.40 on the same fixed scores cannot decrease the number of flagged items. This can recover some missed cases. It can also add false alarms. The precise change in precision depends on the cases added. Use a development set for choosing a threshold. Retain an untouched labelled test set for the final comparison. Otherwise the final numbers may overstate what the system does on new data.
Test whether the evidence travels
Both models were run on the same scans, so their error counts can be compared directly for this sample. The test set might still poorly represent other scanners or types of pages. Compare results by type of scan when there are enough labeled cases for each one. Report how many actual positives are counted in each group: recall of 1 out of 1 and recall of 70 out of 100 have very different evidential weight. Confirm that duplicated or near-identical pages were kept within the same split before comparing performance.
For an engineering decision, also report how much time and memory each algorithm needs on the same device and workload. Measure several trials with the same input batch. Throughput does not establish the correctness of outputs. In the library example a faster model can make sense while missing more scans only if the human checking capacity and the reasons for the errors are understood. Write separate criteria for output quality, capacity and time. Then show which results meet each one.
Interactive Tasks
Quiz: Test Your Knowledge
Which is a true positive in the library example? (A scan missing text is flagged for review) (!A complete scan is flagged for review) (!A scan missing text is passed unchecked) (!A complete scan is correctly passed)
Which two cells sum to the number of genuinely affected scans? (True positives and false negatives) (!True positives and false positives) (!True negatives and false negatives) (!True positives and true negatives)
What is Model A's precision? (60 percent) (!75 percent) (!85 percent) (!88 percent)
What is Model B's recall? (50 percent) (!About 83.3 percent) (!88 percent) (!60 percent)
Why is precision undefined for the baseline that flags nothing? (There are no predicted positives in the denominator) (!All the reference labels are ignored by accuracy) (!The number of actual positives is zero) (!The total number of scans is unknown)
What happens to the set of flags when the fixed score threshold is lowered? (It stays the same size or grows) (!It must shrink) (!It contains exactly the same scans in every case) (!Its precision always rises)
At a cost of five per miss and one per false alarm which model has the lower cost? (Model A with 35 units) (!Model B with 52 units) (!Model A with 85 units) (!Model B with 12 units)
Why keep a separate test split after choosing a threshold? (To estimate performance on cases that had no part in choosing it) (!To choose the threshold again until it passes) (!To remove reference labels from the test) (!To force the two models to make identical predictions)
Which extra information best contextualises a group's recall value? (The number of actual positive cases in the group) (!The number of model file names) (!The order in which teams are listed) (!The appearance of the title page)
Which measurement addresses device speed directly? (Repeated runtime on the same device and workload) (!Precision on 20 labelled damaged scans) (!The number of false negatives) (!The number of label names)
Memory Game
| True positive | Flagged case that really has the target condition |
| False positive | Flagged case without the target condition |
| False negative | Missed case that has the target condition |
| Accuracy | Correct predictions out of all predictions |
| Precision | True positives out of predicted positives |
| Recall | True positives out of actual positives |
Drag and Drop
| Match the situations | Possible responses |
|---|---|
| Estimate the review queue | Add true and false positives |
| Estimate missed damaged scans | Read the false negative count |
| Check the number of complete scans | Add true negatives and false positives |
| Choose a score cutoff | Compare options on the development set |
| Compare practical speed | Time both systems on the same device and batch |
Crossword Puzzle
| baseline | Simple comparator for understanding added value |
| precision | Share of flagged cases that really qualify |
| recall | Share of affected cases that are flagged |
| threshold | Cutoff applied to a score |
| accuracy | Share of all predictions that are correct |
| matrix | Grid organising predicted and actual labels |
LearningApps
If the search returns no suitable result, use the matching task on this page.
Cloze Text
Open Tasks
Easy
- Label four scans: Give a true positive, false positive, false negative and true negative using the scan task.
- Rebuild Model A: From 20 affected, 80 complete, 15 found and 10 false alarms, complete the four cells and check their total.
- Interpret a percentage: Explain what 60 percent precision means in Model A's review queue using the actual count.
- Name the baseline: Describe the always-pass baseline and count its missed affected scans on the stated test set.
Standard
- Calculate three ratios: On 50 cases, TP is 14, FP is 4, FN is 6 and TN is 26. Give accuracy, precision and recall with denominators.
- Compare resource demands: The library can check at most 15 of the flags each day. Compare the two test results and suggest what the library should record before a decision.
- Apply a score cutoff: Given 0.80, 0.60, 0.59 and 0.40, state which are flagged at a threshold of at least 0.60 and then at least 0.40.
- Design a fixed test: Create a plan for comparing two algorithms on the same pages, explaining how you would handle repeated scans of a single page.
Advanced
- Find the break-even cost: Keep a false alarm cost of one and derive the miss cost at which both models have the same total. Compare decisions either side.
- Compare two groups: One scanner's data gives recall 2 out of 2 and another gives 70 out of 100. Explain why ranking the devices by these results alone is weak evidence.
- Audit a report: A report tuned its cutoff on the final 100 scans and then claimed its best result predicts future cases. Explain the methodological problem and design an independent rerun.
- Write a release decision: Choose target constraints for missed scans, checking time and runtime. Explain how you would evaluate each constraint before choosing, and name an important condition to monitor later.
Learning Check
- Build a fresh matrix: Out of 40 scans, 12 lack text. A model flags 9 of those and 7 complete scans. Give the four counts.
- Calculate the metrics: From that fresh matrix give accuracy, precision and recall and explain each in words.
- Compare a baseline: A second model passes all 40 scans. Give its accuracy and recall and explain the precision result.
- Use a cost assumption: For Models A and B in the lesson, make a missed scan cost two and a false alarm cost one. Which costs less?
- Evaluate a threshold trial: A team lowers its cutoff, flags more scans and says precision must rise. Correct the claim and explain where the final estimate should be measured.
- Check a new scanner: Describe a fair comparison when the system will be used on a different device with different page types. Include one measurement of quality and one of computing cost.
Worked checks
- TP = 9 and FN = 3, giving 12 affected. FP = 7 and TN = 21, giving 28 complete. The four cells total 40.
- Accuracy is 30/40 = 75 percent. Precision is 9/16 = 56.25 percent, the share of flags that are justified. Recall is 9/12 = 75 percent, the share of affected scans found.
- The always-pass model gets 28/40, or 70 percent accuracy, and 0/12, or zero recall. It makes no positive predictions, so the precision denominator is zero and precision is undefined.
- Model A costs 5 × 2 + 10 = 20. Model B costs 10 × 2 + 2 = 22. Model A costs less with these assumptions.
- Precision can increase, decrease or stay constant depending on which scans are added. Choose and compare cutoffs on development data, then use a separate reference-labelled test set and report actual counts.
- Use a labelled set from the new device, keep each related page group within one split and run the models on the same inputs. Record recall with its positive count and measure repeated runtime for the same number and types of scans.
Learning evidence
Submit a four-cell matrix, three ratios with denominators and a short decision note. Test that the class totals and the overall total agree. In your decision name one operating constraint and show how changing it can change the decision.
OER and Wikipedia
- Google Machine Learning Crash Course, Accuracy, recall, precision and related metrics – definitions and interpretation.
- Department for Education, GCSE computer science – school context for testing and evaluating algorithms. The lesson applies those skills to an AI example.
- Confusion matrix diagram by Jackverr, CC BY-SA 3.0, unchanged.
- Machine Learning Fundamentals: The Confusion Matrix by StatQuest with Josh Starmer, linked video. The library case and all data were written for this course.
Linked learning areas
aiMOOC Projects
Schulfach+


aiMOOCs


aiMOOC Projekte


MOOCwiki · Deutsch
Nach dem Lernen ist vor dem Lernen
Entdecke direkt den nächsten Lernkurs. Weitere Inhalte erscheinen, wenn Du weiter nach unten scrollst.
Zur MOOCwiki-HauptseiteMediathek
Mediathek wird aus dem Wiki geladen ...
Keine passenden Inhalte gefunden. Bitte ändere Suche oder Filter.
NEWSLernweltNOAH fragen