(1) You need to submit a report and your code to BeachBoard.
(2) This assignment is due 11:59PM on BeachBoard.
(3) Unlimited number of submissions are allowed on Beachboard and the latest one will be
Perceptron for Handwritten Digits Recognition: The handwritten digits files are in the
“data” folder: train.txt and test.txt. The starting code is in the “code” folder. In the data file,
each row is a data example. The first entry is the digit label (“1” or “5”), and the next 256
are grayscale values between -1 and 1. The 256 pixels correspond to a 16 × 16 image. You are
expected to implement your solution based on the given codes. The only file you need to modify
is the “solution.py” file. You can test your solution by running “main.py” file. Note that code is
provided to compute a two-dimensional feature (symmetry and average intensity) from each digit
image; that is, each digit image is represented by a two-dimensional vector before being augmented
with a “1” to form a three-dimensional vector as discussed in class. These features along with the
corresponding labels should serve as inputs to your Perceptron algorithm.
1. (20 points)Familiarize yourself with the data by completing the show images() function. Include the images you plotted into your report.
2. (30 points)In the assignment, we already extracted two features, (symmetry and average
intensity), to distinguish between 1 and 5. Familiarize yourself with the features by completing
the show features() function and include the 2-D scatter plot into your report. For each
sample, plot the two features with a red ∗ if the label is 1 and a blue + if the label is 5.
3. (30 points)Complete the perceptron() function. You can test your accuracy results using the
“test accuracy()” function in “main.py”.
4. (20 points)Complete the show result() function to plot the test data with the separators.
Include the images you plotted into your report.
Deliverable: You should submit a report that summarizes your results and the “solution.py”
file to the BeachBoard.
Note: Please read the “Readme.txt” carefully before you start this assignment. Please do NOT
change anything in the “main.py” and “helper.py” files when you program.