引发 LinAlgError(“SVD 未收敛") LinAlgError:SVD 未在 matplotlib pca 确定中收敛 [英] raise LinAlgError("SVD did not converge") LinAlgError: SVD did not converge in matplotlib pca determination

查看:150
本文介绍了引发 LinAlgError(“SVD 未收敛") LinAlgError:SVD 未在 matplotlib pca 确定中收敛的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码:

import numpy
from matplotlib.mlab import PCA
file_name = "store1_pca_matrix.txt"
ori_data = numpy.loadtxt(file_name,dtype='float', comments='#', delimiter=None,                 converters=None, skiprows=0, usecols=None, unpack=False, ndmin=0)
result = PCA(ori_data)

这是我的代码.尽管我的输入矩阵没有 nan 和 inf,但我确实收到了下面所述的错误.

this is my code. though my input matrix is devoid of the nan and inf, i do get the error stated below.

raise LinAlgError("SVD did not converge") LinAlgError: SVD did not converge

有什么问题?

推荐答案

当数据中有 inf 或 nan 值时可能会发生这种情况.

This can happen when there are inf or nan values in the data.

使用它来删除 nan 值:

Use this to remove nan values:

ori_data.dropna(inplace=True)

这篇关于引发 LinAlgError(“SVD 未收敛") LinAlgError:SVD 未在 matplotlib pca 确定中收敛的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆