I have an vector x whose dimension has to be reduced to 5 x 50 by PCA.
[5,500]=size(x);
while giving the no_dimns=50 I faced a problem
Warning: Target dimensionality reduced to 5.
Is it possible to reduce the dimension of matrix from 5 x 500 to 5 x 50??

 채택된 답변

Shashank Prasanna
Shashank Prasanna 2013년 1월 29일

0 개 추천

I think that the code expects you provide x' or x transpose where the rows are 500 and columns are 5

댓글 수: 8

Berbia
Berbia 2013년 1월 29일
This code reduces only the column dimension of the matrix. If I give x' instead of x, the my input dimension remains 5 and hence the input and output are of same size (no reduction in dimension)
Shashank Prasanna
Shashank Prasanna 2013년 1월 30일
What you are saying is, that you have 500 hundred variables and 5 observations of those variables. And you would like to reduce the dimensions of those 500 variables.
This seems highly doubtful. Are you very sure that you don't have 500 observations of 5 variables? 5 is too few observations.
Or atleast please provide more information on where you got the data and what the colums and rows mean and we can assist you better.
Tom Lane
Tom Lane 2013년 1월 31일
What are you providing as no_dimns? I didn't try it, but the comment in the code implies that you should specify the number of dimensions you want. If you specify this as 5, you'll get no reduction.
Berbia
Berbia 2013년 2월 1일
yes I have 500 variables(as I specified as no_dims) and I need to reduce those dimensions to 50. For training I have more than 500 observations,so it works. I'm working in video processing, in that the features are extracted by appending the [5 500] observations within a loop, and finally it is reduced to [(no_of_times_loop*5) 50] by pca. But in some case(eg,for some videos) the no_of_observations is less than 50, that's why I cant able to perform dimensional reduction before classification. Is it possible to reduce the dimension of variables more than the number of observations??
It is quite possible to reduce the dimensions of variables when there are fewer observations. I recommend you use the PCARES function from the statistic toolbox. http://www.mathworks.com/help/stats/pcares.html
The code you shared does something funny to get the covariance matrix as below when the num of dimensions are larger than the number of observations
C = (1 / size(X, 1)) * (X * X');
Tom may be able to shed more light on this.
But while I use this
residuals = pcares(X,ndim)
the dimension of X and residuals remains same. Is this similar to princomp?Shall I use residuals(:,1:50) as a reduced variables??
It appears the file in your link doesn't reconstruct but just gives you the reduced scores, which means you can do:
[pc,score,latent,tsquare] = princomp(X);
red_dim = score(:,1:50);
PCARES actually reconstructs the scores back to the original basis.
Berbia
Berbia 2013년 2월 1일
I thank you for your prompt response.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Nikos Mp
Nikos Mp 2017년 9월 15일

0 개 추천

2 questions: 1.So we take the scores or the reconstructed data? 2.P.Component = feature ? So we choose the best PComponents?

카테고리

도움말 센터File Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

질문:

2013년 1월 29일

답변:

2017년 9월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by