python - 属性错误: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__'

标签 python scikit-learn artificial-intelligence decision-tree

我要导入 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__'

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

最佳答案

尝试更新 Cython:

pip install cython

关于python - 属性错误: type object 'sklearn.tree._criterion.array' has no attribute '__reduce_cython__' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59293402/

相关文章:

python - 如何在 Python 中创建对数间隔数组?

python - 在列表列表中使用 sum() 时出错

python - 使用 keras 中的 grid_search 和 flow_from_directory 进行 super 参数优化

machine-learning - 策略梯度方法和基于神经网络的 Action 值方法有什么区别?

python - 错误 : suffix or operands invalid for `vbroadcastss'

python - 如何使用 python 和 mysqldb 创建动态 sql 语句

python - 在 hyperopt 中设置条件搜索空间的问题

python - 解释用于文本分类的随机森林模型

c++ - 想写电气工程相关的开源软件

java - 人工神经网络 PSO 训练