2022.4.21 python中关于sklearn 0.18的错误—— cannot import name comb

2022.4.21 python中关于sklearn 0.18的错误—— cannot import name comb,第1张

今天在解决Logistic Regression模型问题时想要导入from sklearn.linear_model import LogisticRegression逻辑回归算法时报错:

ImportError: cannot import name 'comb'

原因为“scipy.misc中的comb位置已经移到scipy.special中,需要按照以下方式找到目标文件进行修改:(推荐安装Anaconda,库的安装导入错误会大大减少)

修改lib\site-packages\sklearn\model_selection\_split.py中from scipy.misc import comb为from scipy.special import comb
修改lib\site-packages\sklearn\metrics\cluster\supervised.py中from scipy.misc import comb为from scipy.special import comb

修改后即可正常运行

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/730933.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-27
下一篇 2022-04-27

发表评论

登录后才能评论

评论列表(0条)

保存