Thread Subject: PCA problem and Memory error

Subject: PCA problem and Memory error

From: Chiemera

Date: 30 Jul, 2010 14:23:46

Message: 1 of 5

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..

Subject: PCA problem and Memory error

From: Peter Perkins

Date: 30 Jul, 2010 14:41:25

Message: 2 of 5

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.

Subject: PCA problem and Memory error

From: Chiemera

Date: 30 Jul, 2010 15:01:44

Message: 3 of 5

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.

Subject: PCA problem and Memory error

From: Peter Perkins

Date: 30 Jul, 2010 16:44:51

Message: 4 of 5

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.

Subject: PCA problem and Memory error

From: Chanchala

Date: 26 Apr, 2011 12:02:04

Message: 5 of 5

Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <i2uvi3$soj$1@fred.mathworks.com>...
> 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.

Hey I applied PCA to the feature vector created using the training data set. And when doing testing i test images one by one. So when i apply PCA to the feature vector related to test image data set of one image it gives and empty matrix which means all the resulted values are 0. I can't understand the reason for that. So what can be the reason for that? Because of this i have got stuck in the middle. Can anyone tel the reason for this?
Thanks in advance

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
applying pca Chanchala 26 Apr, 2011 08:04:10
rssFeed for this Thread

Contact us at files@mathworks.com