From: Tasos on
Hello to everyone,

I use Matlab to read the MNIST database. Those images are, originally, 28x28 (=784) pixels. So, I have a 2D 784x1000 array (meaning, I have read 1000 images).

Supposing my 2D array's name is IMGS, the Matlab expression: IMGS(:, 1), would give me the first image.

In order to perform PCA, so to extract some of the features of the image (from the 784 of them):

1. I transpose the array IMGS, putting the images to rows and features (dimensions) to columns, in an array called IMGS_T (IMGS_T(1, :) corresponds to first image).
2. I use the princomp function like this: [COEFF, SCORES] = princomp(IMGS_T];

My question is this (and it may be a little trivial but, I want to be sure for this):
Supposing I want to extract 100 features from the overall of the 784 of them, all I need is the first 100 columns of SCORES?

So, in Matlab terms, all I need is to write: IMGS_PCA = IMGS(:, 100)'
and I will have created an 100x1000 array, called IMGS_PCA which will hold my 1000 MNIST images in its columns and the first 100 most important features of them in its rows?