sklearn错误ValueError:输入中包含NaN,无穷大或值太大的dtype(’float64’)
在使用sklearn中,我对于Affinity Propagation(AP聚类算法)存在一些问题。我已经建立了一个输入矩阵,但不断收到以下错误。
我运行了
我试过使用
想要删除无限的值,但这也不起作用。 我能做些什么来消除矩阵中的无限值?以便我可以使用AP聚类算法?
我使用的是anaconda和python 2.7.9。
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
我运行了
np.isnan(mat.any()) #and gets False
np.isfinite(mat.all()) #and gets True
我试过使用
mat[np.isfinite(mat) == True] = 0
想要删除无限的值,但这也不起作用。 我能做些什么来消除矩阵中的无限值?以便我可以使用AP聚类算法?
我使用的是anaconda和python 2.7.9。