Week 27 · Unit 11: Artificial Intelligence · 3 lessons
2
How AI learns
Computing 5: Unit 11, pp. 145–158
GoalExplain what artificial intelligence is and how a program can learn patterns from data.
New words
artificial intelligence (AI) · a computer program that learns patterns from data and uses them to make guessespattern · something that happens again and again in the same waytraining data · the examples that an AI program learns fromprediction · a guess about something new, based on what was learned
Explanation
Most programs follow exact steps that a person has written. They do not learn. An artificial intelligence program is different. It is given many examples, called training data, and it finds patterns in them. For example, it can be shown many photos that are labelled ‘ripe’ or ‘not ripe’. Later, it can make a prediction about a new photo. It does not think or understand like a person. It only follows the patterns that it found. The more good and varied examples it learns from, the better its predictions are, but it can still be wrong.
many labelled examples→the program finds patterns→a guess about something new
Worked examples
Fixed program
AI program
Where do the rules come from?
a person writes them
it finds them in the data
Does it improve with more examples?
no
yes, if the examples are good
Example
if the weight is above 300 g, put in box A
learns from photos which mangoes are ripe
A fixed program for sorting mangoes follows a rule that a person wrote. An AI program learns its own rule from examples.
Day
Clouds
Wind
Label
1
dark
strong
rain
2
white
weak
dry
3
dark
weak
rain
4
white
strong
dry
5
dark
strong
rain
6
white
weak
dry
Here are six labelled examples of weather. A program that learns from them finds the pattern: when the clouds are dark, the label is rain. Then it can guess for a new day. Dark clouds with a weak wind: its prediction is rain.
Problem
What happens
too few examples
the program finds a wrong pattern
examples that all look the same
it fails on something different
a new case it never saw
the guess can be wrong
The prediction is a guess. It can be wrong if the examples were few or did not show every case. People must check what AI says.
Class activity
Be the learner (pairs, 12 cards with shapes and colours, paper). Player A secretly chooses a rule, such as ‘a card is IN if it has a circle’. A shows 8 cards, one at a time, and says IN or OUT. Player B has to find the pattern. Then A shows 4 new cards and B predicts IN or OUT. Check B’s guesses. Next time, show only 3 example cards. Does B guess as well? What if all the IN cards in the examples are also red?
Practice
1
Is each one a fixed program or a program that learns from data? (a) a timer that rings after 5 minutes, (b) a program that learns from many labelled bird songs to name the bird it hears, (c) a traffic light that changes every 60 seconds, (d) a junk-mail filter that learns from messages people mark as junk.
(b) and (d) learn from data. (a) and (c) are fixed programs that follow rules a person wrote.
2
A program learned from these examples. What will it guess for a new animal with feathers? Is the guess certain?
Animal
Feathers?
Label
sparrow
yes
bird
owl
yes
bird
trout
no
not a bird
bat
no
not a bird
It will guess ‘bird’. The pattern says feathers mean bird, but a guess is not certain.
3
Why does an AI program need many examples to learn well?
With many examples it can find the pattern that is really there. A few examples can show a wrong pattern, and some cases would be missed.
4
A program learned from photos of brown dogs only. What may go wrong when it sees a white dog?
It may not know that it is a dog, because it never saw a white dog. Training data must show many different cases.