필터 지우기
필터 지우기

Question about different results using PCA and SVD

조회 수: 2 (최근 30일)
HpW
HpW 2022년 8월 16일
댓글: HpW 2022년 8월 16일
Hello
I'm in the process of larning about SVD and PCA, and have been experimenting by using Matlab
I have a 3D set of points as a nx3 column vector called XYZ_orig
I subtracted the mean from X, Y, and Z and perform SVD and PCA on the data:
cent=[mean(XYZ_orig(:,1)), mean(XYZ_orig(:,2)), mean(XYZ_orig(:,3))];
XYZ = [XYZ_orig(:,1)-cent(1),XYZ_orig(:,2)-cent(2),XYZ_orig(:,3)-cent(3)];
[U,S,V] = svd(XYZ);
[coeff,~,~,~,~,~] = pca(XYZ);
my understanding is the basis vectors/coefficients for SVD in 'V' and PCA in 'coeff' should be the same, however, although the 1st column is always the same, I am finding that the second and third columns are always of different sign with the same coefficients.
V =
0.5926 -0.2694 -0.7591
0.7193 -0.2470 0.6493
-0.3624 -0.9308 0.0474
coeff =
0.5926 0.2694 0.7591
0.7193 0.2470 -0.6493
-0.3624 0.9308 -0.0474
Can someone explain why there is this sign difference for columns 2 and 3?
thanks!
hpw

채택된 답변

Steven Lord
Steven Lord 2022년 8월 16일
From the Algorithms section on the pca documentation page: "The pca function imposes a sign convention, forcing the element with the largest magnitude in each column of coefs to be positive. Changing the sign of a coefficient vector does not change its meaning."

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by