Predicting From Examples
In the last two lessons you learned that predictions use clues and patterns. But here is a question: how does a computer learn to predict things? A computer does not have eyes or a nose. It cannot walk outside and feel the wind. So how does it learn what comes next? The answer is examples. Lots and lots of examples.
Learning by Studying Examples
Think about how you learned to recognize a dog. The first time you saw a dog, a grown-up said, "That is a dog." Then you saw another dog. And another. And another. After seeing many dogs — big ones, small ones, fluffy ones, spotted ones — your brain built a picture of what dogs look like. Now when you see a new animal, you can quickly predict: is that a dog? You check it against everything you already learned. A machine does something very similar. People show it thousands of examples, each one labeled. "This is a dog. This is a cat. This is a bird." The machine studies all those examples and looks for patterns. Then when it sees something new, it uses those patterns to predict what it is.
A machine predicts by studying many labeled examples. The more examples it studies, the better it gets at predicting new things it has never seen before.
Here is a simple example you can picture. Imagine you are teaching a friend to sort fruit. You show her an apple and say, "This is an apple — it is round and red." You show her a banana and say, "This is a banana — it is long and yellow." You do this twenty times with different apples and bananas. Now you hand her a fruit she has not seen before. She looks at it. It is round and red. She predicts: apple! She is probably right. That is exactly what machine learning does. It studies examples, finds the patterns in those examples, and then uses those patterns to predict new things.
Fill in the missing word to complete each sentence about how machines learn.
Every example the machine studies teaches it something. A cat photo labeled 'cat' teaches it what cats look like. A photo of a sunny day labeled 'sunny' teaches it what sunny looks like. After thousands of examples, the machine has seen so many patterns that it can make really good predictions on brand new pictures or data it has never seen before. This process of learning from examples is called machine learning — and it is happening inside apps and computers you use every day.
Every time you see a new word in a book and figure out what it means from the sentence around it, you are doing something similar to what a machine does with examples. You learn from what you have seen before.
How does a computer learn to predict what something is?
You show a machine 500 photos of oranges labeled 'orange' and 500 photos of lemons labeled 'lemon.' Now you show it a new photo. What will the machine try to do?
Teach a Friend
- You are going to teach someone to predict, using only examples.
- Pick a simple sorting rule — for example, 'round things' versus 'not round things.'
- Collect eight small objects from around the room.
- Without telling your friend the rule, show them the objects one at a time. Say 'yes' for round things and 'no' for not round things.
- After six examples, hold up a new object. Ask your friend to predict: yes or no?
- See if they figured out the pattern from your examples!
- This is exactly how machines learn: examples with labels, then a new question.