How to use Principal Component Analysis to reduce feature vector size?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (3)
Shashank Prasanna
el 1 de Mayo de 2013
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)
0 comentarios
Adnan
el 6 de Feb. de 2015
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);
0 comentarios
Ver también
Categorías
Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!