每当我从sklearn导入任何Tree模块时,我都会遇到错误。下面是示例代码
from sklearn.ensemble import ExtraTreesRegressor
model = ExtraTreesRegressor()
model.fit(X,y)当我第一次运行代码时,我得到了这个错误-
ImportError: cannot import name 'LatentDirichletAllocation' from 'sklearn.decomposition._online_lda' (C:\Users\lenovo\Anaconda3\lib\site-packages\sklearn\decomposition_online_lda.cp37-win_amd64.pyd)在那之后,每当我运行相同的代码时,我都会得到以下错误-
AttributeError: type object 'sklearn.tree.criterion.array' has no attribute 'reducecython'同样的代码以前工作得很好,但是突然它不再对我起作用了
我也尝试过卸载和重新安装scikit-learn。任何帮助都将不胜感激。谢谢:)
发布于 2020-01-06 17:24:34
我认为这可能是conda install sklearn版本0.22的问题,正如这个issues中所质疑的那样。
试试pip install -U scikit-learn
发布于 2020-01-30 00:52:04
更新scikit-learn,最精确的版本是0.22.1
https://stackoverflow.com/questions/59509204
复制相似问题