MATLAB
Step 01 Download the handwritten digit database "USPS.mat from CANVAS and load this file into your MATLAB session. (a) This file contains four arrays train-patterns test.patterns of size 256 4649 and . train-labels e test labels of size 10 4649, You may find it helpful to think of these arrays as matrices. The arrays train-patterns and test patterns contain a raster scan of the 16 16 gray level pixel intensities that have been normalized to lie within the range,1 The arrays train.labels and test.labels contain the true information about the digit images. That is, if the th handwritten digit image in train patterns truly represents the digiti, then the (i + 1. j)th entry of train-labels is +1?and all the other entries of the jth column of train-labels are-1 (b) Now, display the first 16 images in train-patterna using subplot (4,4,k) and imageac functions in MATLAB Prin o the figure and include it in your Programming Project LaTeX and PDF files. Hint: You need to reshape each column o a matrix of size 16 x 16 fod by transposing display it corectly] order to Step 02 Read the description of this step in Chapter 10.01 of the textbook and/or Professor Saito's Lecture 21. Compute the mean digits in the train patterns and put them in a matrix called train aves of size 256 10 and display these 10 mean digit images using subplot (2,5,k) and imagesc. Print out the figure as a PDF file and include it in your LaTeX and PDF documents te imagesin train-patterns corresponding to digit -1 (1 Hint: You can gather or pool following MATLAB command k 10) using the >>trainpatterns(, trainlabels(k,) Step 03 Read the description of this step in Chapter 10.01 of the textbook and/or Professor Saito's Lecture 21. Now conduct the simplest classification computations as follows. (a) First, prepare a matrix called test-classif of size 10 x 4649 andll this matrix by computing the Euclidearn distance (or its square) between each image in the test-patterns and each mean digit image in train aves Hint: the following line computes the sqared Euclidean distances between all of the test digit images and the kth mean digit of the training dataset with one line of MATLAB code: >>sum((test patterns-repmat (train aves(: ,k), [1 4649])).2) Step 01 Download the handwritten digit database "USPS.mat from CANVAS and load this file into your MATLAB session. (a) This file contains four arrays train-patterns test.patterns of size 256 4649 and . train-labels e test labels of size 10 4649, You may find it helpful to think of these arrays as matrices. The arrays train-patterns and test patterns contain a raster scan of the 16 16 gray level pixel intensities that have been normalized to lie within the range,1 The arrays train.labels and test.labels contain the true information about the digit images. That is, if the th handwritten digit image in train patterns truly represents the digiti, then the (i + 1. j)th entry of train-labels is +1?and all the other entries of the jth column of train-labels are-1 (b) Now, display the first 16 images in train-patterna using subplot (4,4,k) and imageac functions in MATLAB Prin o the figure and include it in your Programming Project LaTeX and PDF files. Hint: You need to reshape each column o a matrix of size 16 x 16 fod by transposing display it corectly] order to Step 02 Read the description of this step in Chapter 10.01 of the textbook and/or Professor Saito's Lecture 21. Compute the mean digits in the train patterns and put them in a matrix called train aves of size 256 10 and display these 10 mean digit images using subplot (2,5,k) and imagesc. Print out the figure as a PDF file and include it in your LaTeX and PDF documents te imagesin train-patterns corresponding to digit -1 (1 Hint: You can gather or pool following MATLAB command k 10) using the >>trainpatterns(, trainlabels(k,) Step 03 Read the description of this step in Chapter 10.01 of the textbook and/or Professor Saito's Lecture 21. Now conduct the simplest classification computations as follows. (a) First, prepare a matrix called test-classif of size 10 x 4649 andll this matrix by computing the Euclidearn distance (or its square) between each image in the test-patterns and each mean digit image in train aves Hint: the following line computes the sqared Euclidean distances between all of the test digit images and the kth mean digit of the training dataset with one line of MATLAB code: >>sum((test patterns-repmat (train aves(: ,k), [1 4649])).2)