1. Create a live script file called “run_digit_recognition.mlx”. Clear workspace and
then load the data. When you load the data, you will observe 2 variables named
images and labels being created in workspace.
2. Visualize every 500th image (1,501, 1001…etc.) to visualize each digit using
imagesc() and gray color map. Try to check the labels for those cases.
3. Now, split the dataset into a set of training and testing data. Use 60th image of each
digit for testing (1, 61, 121 and so on) and rest of the dataset is used for training
Make sure the size of testing images and training images are 20 × 20 × 84 and
20 × 20 × 4916 respectively.
4. Make sure to note the labels of training and testing data as well. Note that train labels
and test labels are of size 4916 × 1 and 84 × 1 respectively.
5. Now, write a nested loop in which you compute the Euclidean distance of each test
image from all training images. So distance would be a vector of size 4916 × 1 for
each test image.
6. Later, determine the case with minimum Euclidean distance for each test image and
note the corresponding index.
7. Determine the label with minimum Euclidean distance and that represents your
predicted label. Repeat this process for all test images.

 

This question has been answered.

Get Answer