问题描述
我正在尝试:
from sklearn.model_selection import cross_validate
如前所述这里.但得到错误:
as mentioned here.But get the error:
ImportError: cannot import name 'cross_validate'
Sklearn 中的其他一切似乎都运行良好,只是这一点.当我运行这一行而不执行其他任何操作时,甚至会发生错误.
Everything else in Sklearn seems to work fine, it's just this bit. Error even occurs when I run this one line and nothing else.
推荐答案
cross-validate
是 0.19.0 (更改日志):
cross-validate
is new in version 0.19.0 (change log):
交叉验证现在能够返回多个结果度量评估.新的 model_selection.cross_validate 可以返回测试数据的许多分数以及训练集的性能和时间,我们已经扩展了评分和改装参数网格/随机搜索以处理多个指标.
为了使用它,如果您使用的是 conda,请使用 conda upgrade scikit-learn
或 pip install --upgrade scikit-learn
更新您的 scikit-learn 安装.如果无法更新,您仍然可以使用 cross_val_score
代替.
In order to use it update your scikit-learn installation with either conda upgrade scikit-learn
if you are using conda, or pip install --upgrade scikit-learn
. If updating is not possible, you can still use cross_val_score
instead.
这篇关于导入错误:无法导入名称“cross_validate"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!