Skip to content
ReEnvision
← Unit 2: Data: what AI learns from

Finding patterns, making predictions

Do by hand what a model does by computation: find a pattern in data and use it to predict.

Lesson 2.3 50 minNo coding required

Objectives

By the end of this lesson, you will be able to:

  • Find a pattern in a small dataset by inspection
  • Use a pattern to predict the label for a new example
  • Explain why predictions come with uncertainty

Key terms

Pattern
A regular relationship in data, such as "larger houses tend to cost more."
Prediction
A model's best estimate of an unknown answer, based on patterns it learned.
Correlation
When two things tend to change together. It does not by itself mean one causes the other.

Reading

Patterns are relationships

A pattern is a relationship that holds across many examples. Taller people tend to have bigger shoe sizes. Messages with many exclamation marks and the word "free" tend to be spam. Homes with more rooms tend to cost more.

Notice the word "tend." Patterns in real data are rarely perfect. There are tall people with small feet. A pattern describes what usually happens, and a model that uses it will usually be right and sometimes be wrong.

From pattern to prediction

Once you have a pattern, you can predict. Shown a new message full of exclamation marks and the word "free," you would guess spam. That is all a model does: it applies the patterns from its training examples to a new case and gives its best estimate.

Many models also report how sure they are, such as "85% likely to be spam." That number is an estimate too. A well-built system uses it sensibly: act automatically when confidence is high, and ask a person when it is not.

Patterns that mislead

Models find whatever patterns best separate their examples, including ones that are accidents. In a well-known kind of failure, a model meant to tell two animals apart in photos instead learns to look at the background, because in the training photos one animal always appeared on snow.

Such a model scores well on similar photos and fails as soon as the background changes. It found a correlation that had nothing to do with the real question. This is why we ask not only whether a model is accurate, but what it is actually relying on.

Try it · Interactive lab

Cause, or just correlated?

Each pair moves together in data. Does the first really cause the second?

Card 1 of 6Score 0

Ice cream sales and sunburns

Group activity 25 min

Human machine learning

You will need

  • A printed table of 16 made-up pets with features (weight, ear shape, sound, lives indoors) and a label (cat or dog), with four rows cut off as a test set
  • Pens
  1. 1

    Study the 12 training rows. In pairs, write the simplest rule you can that predicts the label, such as "if it weighs over 10 kg, dog."

  2. 2

    Check your rule against the 12 rows. Count how many it gets right. Adjust it once if you like.

  3. 3

    Now receive the four hidden test rows. Apply your rule without changing it. Count how many it gets right.

  4. 4

    Compare scores across pairs. Did anyone's rule score perfectly on training but poorly on the test? What did that rule rely on?

Discuss

  1. Q1

    Was your training score higher than your test score? Why might that happen?

  2. Q2

    Ice cream sales and sunburns rise together. Does ice cream cause sunburn? What is really going on?

  3. Q3

    When would you want an AI system to say "I'm not sure" instead of guessing?

Write your answer to one of the questions. Saved only on this device.

Quick check

Choose an answer to see whether you were right, and why.

  1. 1A model says a message is "85% likely to be spam." What does that mean?

  2. 2A model tells two animals apart by the background of the photo rather than the animal. What went wrong?

  3. 3Two things rising together in data is called:

Key takeaways

  • Patterns describe what usually happens, so predictions are sometimes wrong.
  • A model applies learned patterns to new cases and estimates an answer.
  • Models can latch onto accidental patterns, so ask what a model is really relying on.