PCA in MNIST to understand handwriting patterns
Instructions to run code and interesting comments are given in the report.
Multivariate Gaussian fitting for Principal Component Analysis.
Download the dataset comprising images of handwritten digits; this has been downloaded in the folder “data” and stored as “mnist.mat”.
Each image is stored as a matrix (28 × 28) of numbers. You can visualize these images (or
matrices) in MATLAB using the functions imagesc() or imshow().
Constraint: Cannot used the functions mean(), cov(), and pca() of MATLAB.
For every digit, from 0 to 9, compute:
Note: Before computing the mean and covariance matrix, convert each 28×28 pixel image matrix
to a 282 × 1 vector by concatenating its columns. To visualize the 282 × 1 mean vector, convert
it back to a matrix and then visualize it using imagesc(). Use the reshape() function to change
matrices to vectors and vice versa. The covariance matrix will be of size 282 × 282.
• For each digit, I have sorted the 282 eigenvalues of the covariance matrix and have plotted them as
a graph.
• For each digit, I have showed the 3 images side by side:
All graphs are shown in result