How to find relevent principal component .

1 回表示 (過去 30 日間)
DS
DS 2013 年 3 月 27 日
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 Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by