필터 지우기
필터 지우기

Principle Component Analysis Computation

조회 수: 2 (최근 30일)
Algorithms Analyst
Algorithms Analyst 2013년 4월 23일
Hi all I am applying Principle Component Analysis manauall. I have a Dataset let say
Data= [2.5000 2.4000
0.5000 0.7000
2.2000 2.9000
1.9000 2.2000
3.1000 3.0000
2.3000 2.7000
2.0000 1.6000
1.0000 1.1000
1.5000 1.6000
1.1000 0.9000]
when I compute directly by calling the matlab function princomp I get the PC
0.6779 0.7352
0.7352 -0.6779
But when I do manually like that
function [V newX D] = Untitled(X) X = bsxfun(@minus, X, mean(X,1)); %# zero-center C = (X'*X)./(size(X,1)-1); %'# cov(X)
[V D] = eig(C);
[D order] = sort(diag(D), 'descend'); %# sort cols high to low
V = V(:,order);
newX = X*V(:,1:end);
end
0.6779 -0.7352
0.7352 0.6779
I am getting different result just the minis difference why is it/
Thanks in Advance.

채택된 답변

Leah
Leah 2013년 4월 23일
they are the same because the eigenvector (-.7532 0.6779) is equivalent to (.7532 -0.6779)
  댓글 수: 3
Matt Kindig
Matt Kindig 2013년 4월 23일
They are equal because, by definition, all elements of an eigenvector can be scaled by an arbitrary constant without changing the eigenvector. This is a property of eigenvectors. If (-0.7532, 0.6779) is scaled by -1, it gives (0.7532, -0.6779).
Algorithms Analyst
Algorithms Analyst 2013년 4월 28일
If I use the princomp function in matlab using 2D image (grayscale image)
[A B C D]=princomp(img);
so can I say that this is called 2 dimensional principle component analysis?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics 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