Different Result between using PCA from toolbox and using manually programmed PCA

I try to compute PCA on my data. First, I do PCA on the data using function from toolbox. I also do PCA on the data using manual programmed function based my knowledge. First, I calculate covariance matrix of the data. Then, I find its eigenvalue and eigenvector.
PCA using function from toolbox:
[COEFF,SCORE,latent] = princomp(allData);
PCA using manually programmed function:
[V,D]=eig(cov(allData));
Both of those methods yield matrices called coefficient matrix, COEFF for the first and V for the second. Both have exactly same value, but have, sometime, different sign. Can someone explain to me?

回答 (1 件)

Wei Wang
Wei Wang 2012 年 11 月 28 日

0 投票

PCA enforces a sign convention on the coefficients. The largest element in each column will have a positive sign.

1 件のコメント

Numi_Pk
Numi_Pk 2017 年 6 月 23 日
Why PCA enforces a sign convention on the coefficients?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

質問済み:

2012 年 11 月 19 日

コメント済み:

2017 年 6 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by