PCA on square matrix

3 ビュー (過去 30 日間)
Bashir Mohammad Sabquat Bahar Talukder
編集済み: Bish Erbas 2018 年 9 月 26 日
Let's see an example:
>>x = rand(4)
x =
0.8147 0.6324 0.9575 0.9572
0.9058 0.0975 0.9649 0.4854
0.1270 0.2785 0.1576 0.8003
0.9134 0.5469 0.9706 0.1419
>>coeff1=pca(x)
coeff1 =
0.6374 0.1376 -0.1798
0.1070 0.4092 0.9047
0.6684 0.2762 -0.1656
-0.3682 0.8587 -0.3490
>>coeff2 = pcacov(cov(x))
coeff2 =
0.6374 0.1376 -0.1798 0.7365
0.1070 0.4092 0.9047 0.0518
0.6684 0.2762 -0.1656 -0.6705
-0.3682 0.8587 -0.3490 0.0729
From my understanding, coeff1 and coeff2 should be the same. What is wrong here?

採用された回答

Bish Erbas
Bish Erbas 2018 年 9 月 26 日
編集済み: Bish Erbas 2018 年 9 月 26 日
x=rand(4);
c1=pca(x,'algorithm','eig','economy',false)
d1=pcacov(cov(x))
If you use the eig algorithm and set economy to false, outputs will be equal.
Reference:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDimensionality 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