AttributeError: type object ‘sklearn.tree._criterion.array’ has no attribute ‘__reduce_cython__’

我想在Jupyter中导入from sklearn.tree import DecisionTreeRegressor,但当我运行包含上述导入的代码行时,出现了这个错误。

<ipython-input-16-28b3e81cd98d> in <module>----> 1 from sklearn.tree import DecisionTreeRegressor~/.local/lib/python3.6/site-packages/sklearn/tree/__init__.py in <module>      4 """      5 ----> 6 from ._classes import BaseDecisionTree      7 from ._classes import DecisionTreeClassifier      8 from ._classes import DecisionTreeRegressor~/.local/lib/python3.6/site-packages/sklearn/tree/_classes.py in <module>     38 from ..utils.validation import check_is_fitted     39 ---> 40 from ._criterion import Criterion     41 from ._splitter import Splitter     42 from ._tree import DepthFirstTreeBuilder~/.local/lib/python3.6/site-packages/sklearn/tree/_criterion.cpython-36m-x86_64-linux-gnu.so in init sklearn.tree._criterion()AttributeError: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__'

我尝试通过conda安装scipy并更新scikit-learn,但问题没有解决。


回答:

尝试更新Cython:

pip install cython

Related Posts

L1-L2正则化的不同系数

我想对网络的权重同时应用L1和L2正则化。然而,我找不…

使用scikit-learn的无监督方法将列表分类成不同组别,有没有办法?

我有一系列实例,每个实例都有一份列表,代表它所遵循的不…

f1_score metric in lightgbm

我想使用自定义指标f1_score来训练一个lgb模型…

通过相关系数矩阵进行特征选择

我在测试不同的算法时,如逻辑回归、高斯朴素贝叶斯、随机…

可以将机器学习库用于流式输入和输出吗?

已关闭。此问题需要更加聚焦。目前不接受回答。 想要改进…

在TensorFlow中,queue.dequeue_up_to()方法的用途是什么?

我对这个方法感到非常困惑,特别是当我发现这个令人费解的…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注