Machine learning compared with a fixed program

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

Machine learning compared with a fixed program

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A program always gives the same output for the same input and only changes when a programmer edits it. What type of program is this?
A A fixed program
B A machine learning program
2. Who changes the processes or data in a machine learning program as it improves?
A The program itself
B Only the programmer, by editing the code
3. Which statement about results is correct?
A A fixed program's results improve the more it is used
B A machine learning program's results can improve over time
4. A calculator app always gives 12 when you enter 5 + 7. Which type of program is it?
A A fixed program
B A machine learning program
5. A spam filter gets more accurate as users mark emails as spam or not spam. Which type of program is it?
A A fixed program
B A machine learning program

Match the Pairs

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

Left columnRight column
1fixed program AMachine learning needs feedback, such as whether a result was right or wrong, to know how to change its processes or data so it improves.
2machine learning BA fixed program cannot change itself. Only a programmer can edit its instructions. Learning from feedback is what machine learning does.
3A fixed program gives the same output for the same input every time it runs CFollows the same instructions every time, so the same input always gives the same output until a programmer edits it
4Machine learning uses feedback to change its own data, so its answers improve Dspam_score ← spam_score + feedback
5A fixed program learns from feedback and rewrites its own rules EChanges its own processes or data using feedback, so its results can improve over time
6Machine learning needs no feedback because it improves by itself Fif temp > 30 then fan ← ON (never changes)

Definitions

machine learning

Fill in the Blanks

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

1.
threshold _ 30 IF temp > threshold THEN OUTPUT "Hot"
2.
INPUT feedback IF feedback = "wrong" THEN threshold ← _________ - 1
3.
guess ← predict(photo) error ← actual - guess weight ← weight + _____ * 0.1
4.
FUNCTION double(n) ______ n * 2 ENDFUNCTION
5.
_____ accuracy < 90 adjust(weights, error) ENDWHILE

Spot the Error

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

Question 1
A spam_list <- ["win", "free"]
B FOR EACH email IN inbox
C IF user marked it spam THEN
D REMOVE word FROM spam_list
E ENDIF
Question 2
A limit <- 30
B INPUT temp
C IF temp < limit THEN
D OUTPUT "Hot"
E ENDIF
Question 3
A guess <- model(photo)
B feedback <- guess
C IF guess <> feedback THEN
D UPDATE model
Question 4
A price <- 10
B INPUT qty
C total <- price + qty
D OUTPUT total
Question 5
A WHILE
B guess <- model(data)
C feedback <- check(guess)
D model <- adjust(feedback)
E UNTIL accuracy >= 90

Answer Key

Machine learning compared with a fixed program
Section A: Quick Questions
Q1
A — A fixed program
Q2
A — The program itself
Q3
B — A machine learning program's results can improve over time
Q4
A — A fixed program
Q5
B — A machine learning program
Section B: Match the Pairs
Q1
fixed program → Follows the same instructions every time, so the same input always gives the same output until a programmer edits it
Q2
machine learning → Changes its own processes or data using feedback, so its results can improve over time
Q3
A fixed program gives the same output for the same input every time it runs → if temp > 30 then fan ← ON (never changes)
Q4
Machine learning uses feedback to change its own data, so its answers improve → spam_score ← spam_score + feedback
Q5
A fixed program learns from feedback and rewrites its own rules → A fixed program cannot change itself. Only a programmer can edit its instructions. Learning from feedback is what machine learning does.
Q6
Machine learning needs no feedback because it improves by itself → Machine learning needs feedback, such as whether a result was right or wrong, to know how to change its processes or data so it improves.
Section C: Definitions
Q1
machine learning — A program that changes its own processes or data using feedback, so its results improve over time. A fixed program never changes: it follows the same instructions every time.
Section D: Fill in the Blanks
Q1
threshold ← 30 IF temp > threshold THEN OUTPUT "Hot"
Q2
INPUT feedback IF feedback = "wrong" THEN threshold ← threshold - 1
Q3
guess ← predict(photo) error ← actual - guess weight ← weight + error * 0.1
Q4
FUNCTION double(n) RETURN n * 2 ENDFUNCTION
Q5
WHILE accuracy < 90 adjust(weights, error) ENDWHILE
Section E: Spot the Error
Q1
D — A learning spam filter uses feedback to improve its own data. When the user marks an email as spam, it should ADD the word to spam_list, not remove it.
Q2
C — This fixed program should output Hot when temp is greater than the limit. The < operator makes it say Hot for cold temperatures. It should be IF temp > limit THEN.
Q3
B — Learning needs feedback from outside, such as the label a user gives. Copying the program's own guess means the two can never differ, so the model never updates. It should be feedback <- user_label.
Q4
C — A fixed program follows the same instructions every time, so those instructions must be correct. The total should be price multiplied by qty, so it should be total <- price * qty.
Q5
A — The loop ends with UNTIL, so it must start with REPEAT. A learning program repeats guess, feedback and adjust until its accuracy is good enough.