필터 지우기
필터 지우기

How to use Principal Component Analysis to reduce feature vector size?

조회 수: 3 (최근 30일)
DS
DS 2013년 5월 1일
답변: Aya Ahmed 2020년 3월 28일
I am working on emotion recognition.Feature vector size i got is 90x21952(90 is the number of images and 21952 is the coefficients).How can i use princomponent analysis to reduce the feature vector dimension.I am using princomp to find the principal component after that wheter i need to multiply this with meanadjusted original data.If i do so the dimension is no reducing. Please help me.

답변 (3개)

Shashank Prasanna
Shashank Prasanna 2013년 5월 1일
Use PCARES function to do that:
[residuals,reconstructed] = pcares(X,ndim)
The 'reconstructed' will have the reduced dimensions data based on the ndims input. Note that 'reconstructed' will still be the original dimension. You can choose the first ndims if you'd like.
If you want the reduced dimensions in the new basis then just take the first ndims of the SCORE variable
SCORE(:,1:ndims)
[COEFF,SCORE] = princomp(X)

Adnan
Adnan 2015년 2월 6일
Hello Shashank Prasanna, I am using this code to reduce the dimension of my image patch (104*53) If i put img (with out transpose) then the reduced dimension is 104x4, and if i put img'(transpose) then the output in 4x53. So what one is correct?
noofdim=4
[r,c] = size(img);
%Calculate cov matrix and the PCA matrixes
m = mean(img')';
S = ((img - m*ones(1,c)) * (img - m*ones(1,c))');
[Coeff latent]= eig(S);
[latent, ind] = sort(diag(latent), 'descend');
M1 = Coeff(:,ind(1:noofdim));
latent1 = latent(1:noofdim);

Aya Ahmed
Aya Ahmed 2020년 3월 28일
Have you reached the solution ??

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by