I have produced a correlation matrix my_corr = rtn.corr(method = 'pearson')
and I did the PCA composition on that matrix from scipy : eig_vals, eig_vecs = linalg.eig(my_corr)
. However I get negative and complex number for eigen values like
-4.33309269e-16+2.336829340-16j. If I use linalg.eigh
instead of linalg.eig
, I got real values but a lot of negative values too. Why that happen? Thanks for your help
Asked
Active
Viewed 541 times
0
-
1The value `-4.33309269e-16+2.336829340-16j` is likely a numerical approximation of a zero eigenvalue. When you use `eigh`, are the negative eigenvalues as small as this (i.e. all on the order of 1e-16)? – Warren Weckesser Dec 31 '19 at 10:56
1 Answers
0
Without more information like snippet output of linalg.eig
and linalg.eigh
or the rtn
dataframe to begin with, there can be multiple causes. For one, eigh
automatically sorts your eignvalues as opposed to eig
. Eigh
also assumes you have a symmetric my_corr
. More information about this: Difference between linalg.eigh and linalg.eig

LeggoMaEggo
- 512
- 1
- 9
- 24