Examples of machine learning

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Examples of machine learning

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A spam filter becomes better at spotting junk email after users keep marking messages as spam. Which idea does this show?
A Machine learning: the filter improves from experience
B A fixed program: it never changes how it works
2. Which is a machine learning example?
A A calculator adding two numbers the same way every time
B A video app suggesting new clips based on what you have watched
3. A shopping website learns which products a customer tends to buy and suggests similar items. What does it use to improve its suggestions?
A A programmer rewriting the code after every sale
B Past purchases and browsing data
4. A chess program plays thousands of games and gradually wins more often. Is this machine learning?
A Yes: it improves from experience of games played
B No: game programs cannot improve at all
5. Predictive text on a phone starts suggesting the words you use most often. Which statement is correct?
A It learns from what you type and adapts its suggestions
B It only ever uses a fixed list of words that cannot change

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1spam_filter.learn(email, "spam") Aword_count[word] ← word_count[word] + 1
2recommend(history) BA spam filter learns from an email the user marked as spam, so it spots similar emails better in future
3A game-playing program improves because it learns from the results of games it has played CShowing the same list to everyone ignores past behaviour, so it is not a learning recommendation system
4Predictive text learns which words a user types often and suggests them sooner DA recommendation system uses what a user has watched or bought to suggest videos or products they may like
5IF email CONTAINS "free" THEN spam (rule never changes) Ewin_rate ← win_rate + learn(game_result)
6suggestions ← same_list_for_everyone FA fixed rule that never changes is not machine learning, because the program does not improve from experience

Definitions

machine learning

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
result ← model._______(email)
2.
model._____(email, "spam")
3.
suggestion ← _________(watchedVideos)
4.
FOR game ← 1 __ 1000
5.
nextWord ← model.___________(word)

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A TRAIN filter ON no emails
B FOR EACH new email
C IF filter says spam THEN
D MOVE email TO junk
E ENDIF
Question 2
A watched ← video user played
B history ← history + watched
C likes ← IGNORE history
D SHOW videos matching likes
Question 3
A FOR round ← 1 TO 1000
B PLAY round
C IF game won THEN
D punish moves used
E ENDIF
F NEXT round
Question 4
A word ← last word typed
B next ← rarest word after word
C SHOW next AS suggestion
D UPDATE counts FROM user typing
Question 5
A READ customer eye colour
B FIND similar customers
C RECOMMEND what they bought

Answer Key

Examples of machine learning
Section A: Quick Questions
Q1
A — Machine learning: the filter improves from experience
Q2
B — A video app suggesting new clips based on what you have watched
Q3
B — Past purchases and browsing data
Q4
A — Yes: it improves from experience of games played
Q5
A — It learns from what you type and adapts its suggestions
Section B: Match the Pairs
Q1
spam_filter.learn(email, "spam") → A spam filter learns from an email the user marked as spam, so it spots similar emails better in future
Q2
recommend(history) → A recommendation system uses what a user has watched or bought to suggest videos or products they may like
Q3
A game-playing program improves because it learns from the results of games it has played → win_rate ← win_rate + learn(game_result)
Q4
Predictive text learns which words a user types often and suggests them sooner → word_count[word] ← word_count[word] + 1
Q5
IF email CONTAINS "free" THEN spam (rule never changes) → A fixed rule that never changes is not machine learning, because the program does not improve from experience
Q6
suggestions ← same_list_for_everyone → Showing the same list to everyone ignores past behaviour, so it is not a learning recommendation system
Section C: Definitions
Q1
machine learning — A program that improves from experience, e.g. spam filters, shopping or video recommendations, predictive text and game-playing programs that get better the more they are used.
Section D: Fill in the Blanks
Q1
result ← model.predict(email)
Q2
model.train(email, "spam")
Q3
suggestion ← recommend(watchedVideos)
Q4
FOR game ← 1 TO 1000
Q5
nextWord ← model.predictNext(word)
Section E: Spot the Error
Q1
A — A spam filter is machine learning, so it must learn from examples. Line 1 should train it on emails the user has marked as spam, not on no emails.
Q2
C — A video recommendation system improves from experience. It must learn the user's likes from their watch history, not ignore it.
Q3
D — A game-playing program improves by rewarding the moves that led to a win. Punishing them would make it play worse, so the line should be reward moves used.
Q4
B — Predictive text learns which words are used most often. It should suggest the most common word that follows, not the rarest.
Q5
A — Shopping recommendations learn from past behaviour. The program should read the customer's purchase history, which is relevant data, not their eye colour.