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

2 ビュー (過去 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 Center および File ExchangeDimensionality 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