简体   繁体   中英

ImportError: cannot import name 'HalvingGridSearchCV' from 'sklearn.model_selection'

I am running scikit-learn 0.24.2 on the intelpython3_full conda distribution. I am trying to run:

from sklearn.model_selection import HalvingGridSearchCV

and get the following error:

ImportError: cannot import name 'HalvingGridSearchCV' from 'sklearn.model_selection'

I am trying to run it from jupyter notebook.

Already tried reinstalling scikit-learn:

conda uninstall scikit-learn
conda install scikit-learn -c intel 

Also tried:

-c conda-forge

Always get this error. Other imports with sklearn, for instance GridSearchCV work. Can someone help me with this?

Thanks!

Sorry,

after I had search for a long time before, I found the solution like 1 second after my post. :D

This must be run before:

from sklearn.experimental import enable_halving_search_cv 

this:

from sklearn.experimental import enable_halving_search_cv 

Hopefully, it will help someone else in the future!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM