GoalExplain what machine learning is, give everyday examples, and explain why poor training data can give wrong or unfair results.
New words
machine learning · a way for a computer system to improve at a job by learning from data, so that it adapts its own rulestraining data · the examples that a machine learning system learns fromimage recognition · a system that decides what a picture shows by comparing it with what it has learntvirtual assistant · software that carries out tasks for a user from spoken commands, such as answering a question
Explanation
Most programs follow fixed rules that a programmer wrote. A machine learning system is different: it is given many examples, called training data, and it adapts its own rules from them, so it gets better at its job. Everyday uses include image recognition, voice recognition (a virtual assistant learns the words and the voice of its users) and recommendations, which suggest things such as books from what a person chose before. A system can only learn from what it has been shown. If the examples are poor or one-sided, its answers can be wrong or unfair, so people must check them. Many of these systems may keep what you say or type, so never give personal information to an AI chatbot, and ask an adult before using one.
Use
What goes in
What comes out
How it can go wrong
image recognition
a photo
what the photo shows
a blurry photo, or an object it never saw
voice recognition
spoken words
text or a command
accents or voices it never heard
recommendation
what a user chose before
suggestions
too few choices so far
Worked examples
Kind of book
Borrowed before
Borrowed now
mystery
6
6
space
3
8
sport
1
1
A reading app learns from what a reader borrows. Before: mystery 6, space 3, sport 1, so it suggests mystery. The reader then borrows five more space books. Space now has the highest count, so the app suggests space instead, and no programmer changed a rule.
Group
Words tested
Words understood
Percentage
adults
20
19
95%
children
20
12
60%
Poor training data. A caption tool was trained mostly on adult voices. In a test, it understood 19 of 20 words from adults (95%) and 12 of 20 words from children (60%). The tool is not unfair on purpose. Its training data had few children’s voices. The fix is to add more examples and test again with each group.
Message
Fixed rule
Learning filter (after being corrected)
win a prize now
junk
junk
win a pr1ze now
not junk
junk
lunch at one?
not junk
not junk
A fixed rule and a learner. A fixed rule marks a message as junk if it contains the word prize. A sender then writes pr1ze, and the rule misses it. A learning filter sees that people keep marking messages like this as junk, so it adapts and catches them. A person must still check, because it may also catch some good messages.
Class activity
Learn from examples (no computer). Cut 16 cards and draw a shape on each: some stars, some circles, some squares. Colour them red or blue. One player, the teacher, secretly chooses a rule, such as “every star goes in the left pile”. The learner sees one card at a time, guesses the pile, and the teacher says right or wrong. The learner keeps a tally of what is going where. After 8 cards, the learner uses the tally to sort 8 new cards. Next time, make the examples one-sided: let every star that the learner sees be red. Then show a blue star. What does the learner do? What does this tell you about training data?
Practice
1
Write image recognition, voice recognition or recommendation for each use.
Use
Kind
(a) a doorbell camera decides whether a picture shows a parcel
?
(b) a reading app suggests the next story
?
(c) a classroom tool turns the teacher’s speech into text
This program models a recommendation. Predict what it prints.
Python
1kinds = ["poems", "maps", "jokes"]
2counts = [4, 7, 2]
3counts[2] = counts[2] + 64best = 05for i inrange(1, 3):
6if counts[i] > counts[best]:
7 best = i
8print("Suggest:", kinds[best])
Suggest: jokes. The jokes count rises from 2 to 8, which is more than 7 for maps and 4 for poems.
3
A learner says: “A machine learning system never makes mistakes, because it learns.” Correct this.
It can make mistakes. It only knows what its training data showed it, and the data may be poor or one-sided. People must check its results.
4
A road-sign recogniser was trained only with photos taken on sunny days. What could go wrong, and how could the makers improve it?
It may fail in rain, snow or darkness, which it has never seen. The makers can add training photos from all kinds of weather and times of day, and then test it again.