How to find relevent principal component .
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I am trying to do PCA analysis on featurevector size 30x17600, where 30 is the number of images and 17600 is the number of coffecients.
How can I find how many principal componts are requied for corect represtntaion of data.
[M N]=size(feature_vector'); m=mean(feature_vector',2); m_adj = feature_vector' - repmat(double(m),1,N); [evectors, score, evalues] = princomp(feature_vector','econ');
How to find the revelent pricomponent for multiplying with mean adujsted data
feature_vector_final=feature_vector'*evectors;
Please help me.
Thanks in advance
0 Kommentare
Akzeptierte Antwort
Conrad
am 27 Mär. 2013
Calculate the quantity:
cumsum(evalues)./sum(evalues)
The will show you the cumulative variance explained by keeping the first n components. You can also look at the following plot (called a scree plot):
xOffset = -0.2;
yOffset = 2;
nComponentsToShow = 5;
figure; hold on;
p(1) = bar(1e2*evalues(1:nComponentsToShow)/sum(evalues));
ylabel('Variance explained (%)');
xlabel('Factor');
set(p(1),'FaceColor','Black');
set(gca,'XTick',1:size(evalues,1));
for i = 1 : nComponentsToShow
text(i+xOffset,1e2*evalues(i)/sum(evalues)+yOffset,sprintf...
('%0.2f%%',1e2*sum(evalues(1:i))/sum(evalues)));
end
Looking at the total variance explained you can decide on how many components to keep.
Conrad
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!