AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Actuators and AI

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.

Worked examples
Fixed programAI program
Where do the rules come from?a person writes themit finds them in the data
Does it improve with more examples?noyes, if the examples are good
Exampleif the weight is above 300 g, put in box Alearns 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.
DayCloudsWindLabel
1darkstrongrain
2whiteweakdry
3darkweakrain
4whitestrongdry
5darkstrongrain
6whiteweakdry
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.
ProblemWhat happens
too few examplesthe program finds a wrong pattern
examples that all look the sameit fails on something different
a new case it never sawthe 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.
2
A program learned from these examples. What will it guess for a new animal with feathers? Is the guess certain?
AnimalFeathers?Label
sparrowyesbird
owlyesbird
troutnonot a bird
batnonot a bird
3
Why does an AI program need many examples to learn well?
4
A program learned from photos of brown dogs only. What may go wrong when it sees a white dog?
training photos: brown dogsnew photo: a white dog