Codiqo

Understanding AI · lesson 23 of 60 · about 6 minutes

Accuracy Isn't Everything

A model can be 99% accurate and still useless. Learn about false alarms and misses.

What you'll learn

  • Tell false alarms from misses
  • Count both kinds of mistake
  • Explain why accuracy can hide problems

Two kinds of wrong

A smoke alarm can go wrong in two ways. It can go off when there's no fire: a false alarm. Or it can stay quiet during a real fire: a miss.

AI that answers yes or no makes the same two kinds of mistake, and they're rarely equally bad.

When accuracy fools you

Suppose 1 in 100 people has an illness. A test that always says healthy is 99% accurate, and misses every single person who's ill. Counting the misses shows the truth that accuracy hides.

Counting both kinds of mistake. True means ill (or alarm sounding); False means healthy (or quiet).

guesses = [False, True, False, False]
answers = [False, False, True, False]
false_alarms = 0
misses = 0
for g, a in zip(guesses, answers):
    if g and not a:
        false_alarms = false_alarms + 1
    if a and not g:
        misses = misses + 1
print("false alarms:", false_alarms)
print("misses:", misses)

Output

false alarms: 1
misses: 1

Tip

Always ask what kind of mistakes a model makes, not just how many.

Now try it yourself

This lesson is free in Codiqo, with 6 questions on what you just read. You can only learn to code by writing code, so it ends with a short program you write yourself, which we run and check straight away.