How to apply PCA for reducing the dimension of a vector?!

9 views (last 30 days)
Hello, I want to reduce the dimension of a vector from 1296 to 128. Is there any function in matlab for this purpose?! Actually I'm trying to implement a paper's code! And in that paper was wrote: "Finally, we apply PCA to reduce the feature dimensionality to M (M = 128 in this paper)."

Answers (1)

John D'Errico
John D'Errico on 6 Dec 2014
Edited: John D'Errico on 6 Dec 2014
No, you cannot use PCA to reduce the dimensionality of a single vector, if that is all you have.
Perhaps you misunderstand the purpose of PCA. It allows you to use a set of data in multiple dimensions with multiple samples, wherein the multiple samples allow you to learn the structure of what is happening in that multiple dimensional space. (A poor description as I look at it, but I'm feeling lazy this morning.)
You have ONE vector, thus ONE sample. PCA can do nothing here. There is virtually no useful information content to be gained from one piece of information.
  3 Comments
John D'Errico
John D'Errico on 6 Dec 2014

You have still shown only one vector that I see.

PCA uses a large set of vectors, that often have redundant information in them. For example, suppose I were to research the movie viewing habits of MANY people. I'll interview them to learn every movie they watched over some period of time. There may be thousands of different movies that cumulative group saw in that period of time. So I could store ALL of the information for every person. Or...

I'll bet that if one person watches one sci-fi film, one zombie horror film, one chic flick, etc., they will watch others of that same genre. We could now use the viewing habits of that large sample of people to learn that many individuals fall into only a few fundamental viewing patterns. PCA would allow us to extract those patterns, thus representing any individual in terms of how well they fall into the chic flick category, zombie watcher, etc.

Mehran Kh
Mehran Kh on 9 Dec 2014
Thanks for your explanation John, Actually I'm using histograms as feature vectors for face recognition, I have 700 Images as training set (and 700 test images) that each image have at least 20 feature vectors, So I have a 14000*1296 Matrix. You say that, I should extract all histograms of all persons and then doing dimension reduction?!

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!