简体   繁体   中英

Error using KFold (from sklearn.model_selection import KFold)

I am getting an error while using from sklearn.model_selection import KFold in my jupyter notebook.

The error says "No module named 'sklearn.model_selection'". When I printed

print(sklearn.__version__)

I got the version to be 0.17.1.

Can anyone help me understand what is the problem?

Under version 0.17.1 KFold is found under sklearn.cross_validation . Only in versions >= 0.19 can KFold be found under sklearn.model_selection

So you need to change your import to:

from sklearn.cross_validation import KFold

See API for version 0.17

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