简体   繁体   English

AttributeError:类型对象“sklearn.manifold._barnes_hut_tsne.array”没有属性“__reduce_cython__”

[英]AttributeError: type object 'sklearn.manifold._barnes_hut_tsne.array' has no attribute '__reduce_cython__'

I'm trying to run a code in Python to import Kmeans using sklearn.我正在尝试在 Python 中运行代码以使用 sklearn 导入 Kmeans。 However, when I try to import, I get this error message:但是,当我尝试导入时,我收到此错误消息:

AttributeError: type object 'sklearn.manifold._barnes_hut_tsne.array' has no attribute ' reduce_cython ' AttributeError:类型对象“sklearn.manifold._barnes_hut_tsne.array”没有属性“ reduce_cython

sklearn is installed with all the necessary packages. sklearn 与所有必要的软件包一起安装。 I'm unsure as to what the problem might be.我不确定可能是什么问题。 Here is part of the code from my work involving the import:这是我的工作中涉及导入的部分代码:

from sklearn.cluster import KMeans
num_clusters = 8
km = KMeans(n_clusters=num_clusters)
%time km.fit(tfidf_matrix)
clusters = km.labels_.tolist()

even if I put from sklearn.cluster import KMeans all by itself, I get the same error, so the error is coming from that line of code alone.即使我把from sklearn.cluster import KMeans全部放在自己身上,我from sklearn.cluster import KMeans得到同样的错误,所以错误仅来自那行代码。 Any help would be appreciated.任何帮助,将不胜感激。

NOTE: I am using Jupyter Notebook and yes, I have installed any and all necessary packages as well as updated sklearn.注意:我正在使用 Jupyter Notebook,是的,我已经安装了所有必要的软件包以及更新的 sklearn。

Just uninstalled scipy and installed it again and restarted the kernel and then run the code.刚刚卸载了scipy,重新安装,重启内核,然后运行代码。 It worked for me.它对我有用。 Basically it is due to the Kernel restart issue.基本上这是由于内核重启问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError:类型对象“sklearn.tree._criterion.array”没有属性“__reduce_cython__” - AttributeError: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__' AttributeError: 类型对象 'sklearn.tree._tree.TreeBuilder' 没有属性 '__reduce_cython__' - AttributeError: type object 'sklearn.tree._tree.TreeBuilder' has no attribute '__reduce_cython__' AttributeError: type object 'spacy.syntax.nn_parser.array' 没有属性 '__reduce_cython__' ,(向虚拟环境添加路径) - AttributeError: type object 'spacy.syntax.nn_parser.array' has no attribute '__reduce_cython__' , (adding Paths to virtual environments) AttributeError: type object 'h5py.h5r.Reference' 没有属性 '__reduce_cython__' - AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__' AttributeError:类型 object 'netCDF4._netCDF4._MemBuf' 没有属性 '__reduce_cython__' - AttributeError: type object 'netCDF4._netCDF4._MemBuf' has no attribute '__reduce_cython__' AttributeError:类型 object 'pandana.cyaccess.cyaccess' 没有属性 '__reduce_cython__' - AttributeError: type object 'pandana.cyaccess.cyaccess' has no attribute '__reduce_cython__' 导入 modin.pandas 导致错误:AttributeError:类型 object 'pyarrow.lib.Message' 没有属性 '__reduce_cython__' - import modin.pandas causes ERROR: AttributeError: type object 'pyarrow.lib.Message' has no attribute '__reduce_cython__' “gensim._matutils.array”没有属性“__reduce_cython__” - 'gensim._matutils.array' has no attribute '__reduce_cython__' AttributeError:类型对象“ h5py.h5r.Reference”在使用“从keras.utils导入HDF5Matrix”时没有属性“ __reduce_cython__” - AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__' on using “from keras.utils import HDF5Matrix” Cython AttributeError: 'module' 对象没有属性 'declare' - Cython AttributeError: 'module' object has no attribute 'declare'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM