Confusion Matrix and Accuracy
Accuracy alone can mislead, so we look at the kinds of mistakes. A confusion matrix counts them. For a yes/no problem it holds: true negatives, false positives, false negatives and true positives.
- Accuracy: the share of all predictions that were right.
- Precision: of those predicted positive, how many really were.
- Recall: of the real positives, how many did we find.
Examplepython
Quick check
A test for a rare illness misses many sick people. Which metric exposes this?
Your turn: write the code
Print the recall for these predictions, rounded to 2 decimals.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.