forum.alglib.net
http://forum.alglib.net/

pcabuildbasis gives incorrect eigenvectors?
http://forum.alglib.net/viewtopic.php?f=2&t=3877
Page 1 of 1

Author:  fdlwang [ Tue Dec 18, 2018 2:37 pm ]
Post subject:  pcabuildbasis gives incorrect eigenvectors?

Hi All,

I noticed that the package pcabuildbasis for principal component analysis has some weird behavior. I compared the results of pcabuildbasis with those obtained from Matlab pca (https://www.mathworks.com/help/stats/pca.html). Surprisingly, ALGLIB's pcabuildbasis and Matlab's pca give different results on the eigenvectors.

For example, given raw data A ={1.0,2.0,3.0;1.0,2.0,3.0;1.0,2.0,3.0;3.0,2.0,1.0}, pcabuildbasis returns the matrix for eigenvectors as
{-0.7071, -0.7071, 0; -0.7071, 1.0, -9.26e+061; 0, -9.26e+061, -9.26e+061},
however, Matlab pca (https://www.mathworks.com/help/stats/pca.html) gives eigenvector matrix as
{-0.7071, 0.7071, 0; 0, 0, 1.0; 0.7071, 0.7071, 0}.
The results are totally different.

I tested two other data inputs (listed at the end), they also gave different results on the eigenvector. I'm totally confused with this problem. I'll be very grateful if you could help solve this problem!

Thanks much,
Lin

Data Input2 =
[1.0, 2.0, 3.0;
1.0, 3.0, 2.0;
3.0, 1.0, 2.0;
3.0, 2.0, 1.0 ]


Data Input3 =
[7 26 6 60
1 29 15 52
11 56 8 20
11 31 8 47
7 52 6 33
11 55 9 22
3 71 17 6
1 31 22 44
2 54 18 22
21 47 4 26
1 40 23 34
11 66 9 12
10 68 8 12]

Author:  Sergey.Bochkanov [ Fri Dec 21, 2018 10:04 am ]
Post subject:  Re: pcabuildbasis gives incorrect eigenvectors?

How exactly you call pcabuildbasis()? I've tried it at my PC, and everything worked fine.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/