raise LinAlgError(“SVD did not converge”) LinAlgError: SVD did not converge in matplotlib pca determination

前端 未结 9 1218
后悔当初
后悔当初 2021-02-05 02:10

code :

import numpy
from matplotlib.mlab import PCA
file_name = \"store1_pca_matrix.txt\"
ori_data = numpy.loadtxt(file_name,dtype=\'float\', comments=\'#\', de         


        
9条回答
  •  野性不改
    2021-02-05 02:53

    Following on @c-chavez answer, what worked for me was first replacing inf and -inf to nan, then removing nan. For example:

    data = data.replace(np.inf, np.nan).replace(-np.inf, np.nan).dropna()
    

提交回复
热议问题