PCA on square matrix
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bashir Mohammad Sabquat Bahar Talukder
am 26 Sep. 2018
Bearbeitet: Bish Erbas
am 26 Sep. 2018
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?
0 Kommentare
Akzeptierte Antwort
Bish Erbas
am 26 Sep. 2018
Bearbeitet: Bish Erbas
am 26 Sep. 2018
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!