From: Chiemera on
Hello,
I have a matrix, size of 160x162x10. I want to reduce its dimension. I
used codes below:

samp_pca=reshape(samp,[160*162 10])';
[COEFF,SCORE] = princomp(samp_pca);

But it produces "Out of Memory" error on MatLab 2010a. I increased the
physical memory of Windows 7. But nothing changed.
Is my approach to use PCA correct?
If so, How can I overcome this error?
Regards..


From: Peter Perkins on
On 7/30/2010 10:23 AM, Chiemera wrote:
> samp_pca=reshape(samp,[160*162 10])';

With that transpose, you're telling princomp that you have 10
observations on 25920 variables. That may be what you intend, with 10
images of 160x162 pixels each. You can do that, but you'll need to use
the 'econ' flag, otherwise you're asking for 25920 PC's in 25920 dims.

>> help princomp
PRINCOMP Principal Components Analysis.
[snip]
[...] = PRINCOMP(X,'econ') returns only the elements of LATENT that are
not necessarily zero, i.e., when N <= P, only the first N-1, and the
corresponding columns of COEFF and SCORE. This can be significantly
faster when P >> N.
From: Chiemera on
Thanks Peter. I used PRINCOMP with econ. But I couldn't understand the
result. I mean it produced a SCORE matrix, size of 10x9. I just want
to reduce the dimension of matrix, size of 160x162x10 but not this too
much, 10x9. I have 10 tests, each has 160x162 inputs. I want to use
these inputs, after reducing the dimension, for input of SVM. This is
my problem.
Too small 10x9 for SVM as input.
From: Peter Perkins on
On 7/30/2010 11:01 AM, Chiemera wrote:
> Thanks Peter. I used PRINCOMP with econ. But I couldn't understand the
> result. I mean it produced a SCORE matrix, size of 10x9. I just want
> to reduce the dimension of matrix, size of 160x162x10 but not this too
> much, 10x9. I have 10 tests, each has 160x162 inputs. I want to use
> these inputs, after reducing the dimension, for input of SVM. This is
> my problem.

You have _10 observations_. That means that any PC beyond the ninth,
all 25911 of them, will be _all exactly zero_. Ninth, not tenth,
because PRINCOMP subtracts the mean.