# Can PCA be applied twice or more? [duplicate]

I have a very high-dimensional dataset with 27k features. I want to a reduce the dimensionality of the dataset. I want to use PCA to reduce the dimensionality to 2 as the toolbox I am using expects 2 dimensions.

But When I am trying to apply PCA in Matlab I am getting an out of memory error. Can I apply PCA twice to get down to 2 dimesions, i.e. 27k -> intermediate -> 2 dimensions?

• In theory you could, but it really doesn't make any sense to do so. If you take a pca on your pca, you ignore the fact that some PCs matter more than others. If you really want just two dimensions, why don't you just take the first two PCs (although not knowing your system, this may not make sense)? Feb 4 '16 at 14:43
• You mean to say run pca once and the then consider first 2 dimensions of the resultant matrix. ? But I am worried will it still retain the the original information of the original matrix .? Feb 4 '16 at 14:46
• Please provide the exact commands you are using in Matlab that result in the "out of memory" error. What commands do you use to perform your "27k->intermediate" step? Why doesn't it yield the same error too? Feb 4 '16 at 15:05
• yes, it should give the same error for the "27k -> intermediate" part too, so i don't see the point for an intermediate step. however, there is an 'econ' option of matlab's pca, that could be useful.
– jeff
Feb 4 '16 at 15:11
• Initially I used to use the below command in matlab A = load(dataset); [coeff,score,latent] = pca(A); It is working fine but it is not giving me 2 dimensions. But I have a tool box from MIT where they use different types of preprocessing the datasets. classification algorithm which I want to implement in that tool box accepts only two dimensions. In that toolbox they provided different preprocessing option to reduce it to 2 dimension. When I used PCA option in their tool box in matlab command it is througing me out of memory error. Feb 4 '16 at 16:35