seegongsik
AI

What does learning mean in AI

Say you have heaps of cat photos and dog photos. How would you get a computer to tell them apart? You could write out rules for ear shape, nose, and fur one by one, but every photo looks different, so the rules never end. So we take another road: show the machine heaps of photos with the answers attached and let it find the difference on its own. That is what it means for a machine to learn.

01

A person writes the rules

The programs we have seen so far follow commands a person wrote, exactly as written. To get them to do anything, a person first had to think up the rules and write them down. Take filtering spam mail as an example.
Throw it out if it contains the word "sale"; throw it out if it has too many links; throw it out if it is written in all capitals. Write rules like these one by one, and it seems most spam should get caught.

Rules (tap to toggle)
Inbox
mail 1missed
mail 2fine
mail 3missed
mail 4fine
mail 5missed
mail 6missed
Turn on rules to filter spam

Turn the rules on and off one at a time to filter the mail. Even with every rule on, one spam mail that changed its look slips through.

The more rules you turn on, the more spam gets caught. But one always slips through, because spammers keep changing how their mail looks to avoid being caught: instead of "sale" they write "free gift," and they hide links inside pictures.
Each time, you have to write yet another rule, so the rules grow without end. Rules can clash with each other, and setting them too strictly throws out normal mail as well. Writing every rule by hand cannot keep up with changes like these.

02

Find the rule from examples

This time, let's flip the road. Instead of writing rules, you show the machine heaps of examples with the answers attached: thousands of emails, each marked "this is spam" or "this is fine."
Looking at these examples, the machine works out for itself what spam emails have in common and what normal ones have in common. The pattern it finds is the rule the machine made. Learning from examples that come with answers like this is called supervised learning.

Example space
● spam● fine
Seen 0 examples

Show the labeled examples one at a time. As they pile up, the pattern that separates the two groups becomes clearer.

As the examples piled up, the boundary between the two groups became clearer. No person drew that boundary; the machine found it directly in the examples.
What is remarkable is that even differences people can hardly put into words get caught, as long as there are enough examples. The first pattern it finds is still rough, though, and it may sort a few examples wrongly. How is the pattern refined?

03

It fixes itself bit by bit

Learning is not finished in one go. The machine looks at an example, gives an answer, and compares it with the correct one. If it was wrong, it measures how wrong and adjusts the pattern just a little.
If it is wrong again on the next example, it adjusts again. Repeat this countless times, and the number of mistakes keeps falling. How the error is measured and how the adjustments are made are covered in detail later, under the names loss function and gradient descent.

Accuracypolish round 0
55% accuracy
9 wrong
Give more examples to raise accuracy

Feed in one more batch of examples at a time. With every tap the machine adjusts its pattern, accuracy rises, and the number of wrong examples falls.

Every batch of examples raised the accuracy. A pattern that started out getting just over half right was getting nine out of ten right after a few rounds of refining.
It does not keep improving forever, though. Past a certain point it improves only a little at a time, and one stubborn example may stay wrong. Even so, we have come this far with far less effort than writing rules by hand. So what is a refined pattern like this used for?

04

It predicts new inputs too

Here is the real reward of learning. The examples used for training already come with answers; the usefulness shows when the machine meets a new email it has never seen.
The machine holds the new email up against the pattern it has refined and decides whether it is spam or normal. Because it found a pattern rather than memorizing the examples, it can give an answer even for mail it is seeing for the first time. Making a guess like this about a new input is called prediction.

New mail (not used in training)
Tap a new mail to see the prediction

Tap a new email that was not used in training. The machine predicts spam or fine using the pattern it learned, and tells you whether it was right.

It sorted most of the unseen emails correctly. It did not pull out a memorized answer; it applied the pattern found in the examples to the new input. So even when the shape is a little different, it can judge by the resemblance.
But sometimes it misses, as with the last email, because the pattern is not perfect. That is why machine learning sets aside examples that were not used in training and uses them to measure how well the model handles new inputs.

05

Summary

To sum up: an ordinary program follows rules a person wrote, but the world is too complicated to capture entirely in rules. So machine learning flips the road. Show the machine heaps of examples with answers, and it finds the common pattern, which is to say the rule.
When it is wrong, it fixes itself bit by bit and gets better, and with that pattern it predicts even inputs it has never seen. Learning from examples instead of writing rules: that is the heart of it.

Tap the four key points in order
Tap the points below in order from the top

Tap the key points in order to review. (a person writes rules → find rules from examples → fix by getting things wrong → predict new inputs)

Now you know what it means for a machine to learn: instead of a person teaching every detail, the machine looks at examples and finds the rules for itself. Today's machines that recognize photos and understand speech all started from this idea.
To find patterns in examples, though, you first need to be able to summarize and read data. The next lesson, on statistics, covers how to describe a bunch of data with a few numbers, such as where its middle is and how spread out it is.

In one lineAn ordinary program runs on rules a person wrote out one by one. But the world has so many rules, and they change so often, that writing them all down is hard. Machine learning flips the road. Show the machine heaps of examples with the answers attached, and it finds the common pattern in those examples, the rule, by itself. At first it gets things wrong, but it measures how wrong and fixes itself bit by bit until it gets better. With that refined pattern, it can predict even a brand-new input it has never seen, and how well it does is measured with examples kept out of training. Instead of a person writing the rules, the machine finds them from examples, fixes its mistakes, and predicts new things: that is what learning means.
← AI
Was this helpful? Support seegongsik