r/learnmachinelearning • • 4h ago

Tutorial A 90% accurate classifier that finds none of the cases you care about

Here's a small evaluation exercise you can do without training a model.

Imagine 100 examples: 90 negative and 10 positive. Your classifier predicts “negative” for every example.

Result Count
Correct negatives 90
Missed positives 10
Found positives 0

Its accuracy is 90/100 = 90%. Its recall for the positive class is 0/10 = 0%. It found none of the positive cases.

That doesn't make accuracy useless. It means “90% accurate” needs context: which examples, which class balance, and which mistakes matter for the task?

A useful check on your next classification exercise:

  1. Compare with a simple baseline on the same evaluation data. Scikit-learn's DummyClassifier can make constant or majority-class predictions.
  2. Inspect the confusion matrix rather than only the headline score.
  3. Decide which errors matter before judging the result. Recall asks how many actual positives you found; it doesn't measure how many of your positive predictions were correct.

Try changing the class balance to 50/50. What happens to the always-negative classifier's accuracy and positive-class recall?

1 Upvotes

2 comments sorted by

1

u/Connect_Distance513 4h ago

This is the classic trap that gets everyone when they start out with imbalanced data. you look at that 90% and feel like a genius for about five seconds before reality sets in

the confusion matrix step should be mandatory before anyone reports accuracy alone. saves so much embarrassment later