3.1 Rules vs. Learning
To understand how machine learning works, it's a good idea to start with the traditional and maybe alternative approach: rules.
Last updated
Was this helpful?
To understand how machine learning works, it's a good idea to start with the traditional and maybe alternative approach: rules.
Last updated
Was this helpful?
In this exercise, we are going to use the popular MNIST data set of handwritten digits to work out the problems when we try to define rules for a seemingly simple task: recognize and classify handwritten digits.
Search online for version of the MNIST data set in CSV format. If you can't find one, you can refer to . Download the data set, extract the file, and open it in a text editor.
What does an image look like to a computer?
What do all the numbers in one line mean?
To get a better understanding of how a computer sees and displays images, add a feature to your web app that takes a representation of a digit as an array of numbers and display it on the website pixel by pixel. Take a look at the and especially the following functions:
createCanvas()
square()
stroke()
fill()
Additionally, if you want to add the rows and column labels:
text()
textSize()
You can use the following array of the number 3 shown below as your input data:
Now that we have a better understanding of how a computer represents images, let's try to come up with rules that allow us to recognize the particular digit behind a long list of numbers. For simplicity, start with only the number 3 and write a program that outputs true
or false
. true
meaning the list of numbers is a 3, and false
it is not. This is called binary classification because we only distinguish between two answers.
How can you teach this seemingly easy task (for humans) to a computer?
Why is it so difficult to articulate the rules that determine whether it's a 3 or not?