← Lessons

quiz vs the machine

Silver1050

Machine Learning

Accuracy And Its Pitfalls

Why the simplest metric can quietly lie on imbalanced data.

4 min read · intro · beat Silver to climb

What accuracy measures

Accuracy is the fraction of predictions the model got right. If you make one hundred predictions and ninety match the truth, accuracy is ninety percent. It is easy to compute and easy to explain, which is exactly why it is so often misused.

The imbalance trap

Imagine a fraud detector where only one in a thousand transactions is fraud. A lazy model that always predicts not fraud scores 99.9 percent accuracy while catching zero fraud. The number looks dazzling and the model is useless.

Why this happens

  • Accuracy weights every example equally.
  • When one class dominates, the majority class drowns out the rare class.
  • A high score can hide complete failure on the cases you actually care about.

What to do instead

  • Report precision and recall for the rare class.
  • Inspect the full confusion matrix, not a single number.
  • Consider balanced accuracy, which averages the recall of each class.

Key idea

Accuracy is honest only when classes are balanced. On skewed data a high accuracy can mask total failure on the minority class, so always pair it with class aware metrics.

Check yourself

Answer to earn rating on the learn ladder.

1. Why can accuracy mislead on imbalanced data?

2. A fraud rate of one in a thousand and an always not fraud model gives what accuracy?