Lesson 3 of 4
Classification basics
Watch, read the card, then practise. Classification models · Accuracy and the confusion matrix · Precision and recall
The video for this lesson is being recorded.
Meanwhile, the notes below and the 60-second cards cover the same ideas.
Practise this topicClassification models
A classifier predicts a category, often by first giving a probability and then applying a threshold.
Remember: Probability first, then a threshold decides the class.
Accuracy and the confusion matrix
A confusion matrix counts the four kinds of right and wrong answers.
Remember: Accuracy can mislead when one class is rare.
Precision and recall
Precision asks 'of my alarms, how many were real?' Recall asks 'of the real ones, how many did I catch?'
Remember: Missing a disease is costly → care about recall. Annoying false alarms → precision.
Try the example in Code Lab
probs = [0.9, 0.4, 0.65, 0.2] print(["spam" if p >= 0.5 else "not spam" for p in probs])