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

Learning machines at work

Week 29 · 4.6 AI and computerisation · 3 lessons
1

Learning from examples

Computing 9: Topic 4.6, pp. 348–358
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.

UseWhat goes inWhat comes outHow it can go wrong
image recognitiona photowhat the photo showsa blurry photo, or an object it never saw
voice recognitionspoken wordstext or a commandaccents or voices it never heard
recommendationwhat a user chose beforesuggestionstoo few choices so far
Worked examples
Kind of bookBorrowed beforeBorrowed now
mystery66
space38
sport11
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.
GroupWords testedWords understoodPercentage
adults201995%
children201260%
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.
MessageFixed ruleLearning filter (after being corrected)
win a prize nowjunkjunk
win a pr1ze nownot junkjunk
lunch at one?not junknot 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.
UseKind
(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?
2
This program models a recommendation. Predict what it prints.
Python
1kinds = ["poems", "maps", "jokes"]
2counts = [4, 7, 2]
3counts[2] = counts[2] + 6
4best = 0
5for i in range(1, 3):
6    if counts[i] > counts[best]:
7        best = i
8print("Suggest:", kinds[best])
3
A learner says: “A machine learning system never makes mistakes, because it learns.” Correct this.
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?