![](/img/trans.png)
[英]ImportError: cannot import name 'StratifiedGroupKFold' from 'sklearn.model_selection'
[英]ImportError: cannot import name 'HalvingGridSearchCV' from 'sklearn.model_selection'
我在 intelpython3_full conda 發行版上運行 scikit-learn 0.24.2。 我正在嘗試運行:
from sklearn.model_selection import HalvingGridSearchCV
並得到以下錯誤:
ImportError: cannot import name 'HalvingGridSearchCV' from 'sklearn.model_selection'
我正在嘗試從 jupyter notebook 運行它。
已經嘗試重新安裝 scikit-learn:
conda uninstall scikit-learn
conda install scikit-learn -c intel
也試過:
-c conda-forge
總是得到這個錯誤。 使用 sklearn 的其他導入,例如 GridSearchCV 工作。 有人可以幫我弄這個嗎?
謝謝!
對不起,
在我之前搜索了很長時間之后,我在發布后 1 秒找到了解決方案。 :D
這必須在之前運行:
from sklearn.experimental import enable_halving_search_cv
這個:
from sklearn.experimental import enable_halving_search_cv
希望它會在未來對其他人有所幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.