How to find relevent principal component .

1 次查看(过去 30 天)
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

采纳的回答

Conrad
Conrad 2013-3-27
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
  1 个评论
DS
DS 2013-3-27
Thanks for the reply.I tried with this code.In the y-axis I am getting high amplitude and showing above the bar as 96.04% for the 1st factor for the remaining i am getting very low amplitude and showing above the bar in the range of (96 % to 100).Whether it maens only first principal componnet is required? Also I have a doubt why the xoffset = -.2 and yoffset=2; Thanks in advance

请先登录,再进行评论。

更多回答(0 个)

类别

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