Click here to Skip to main content
15,664,808 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i'm getting the above error how to resolve it.

What I have tried:

I have updated my sckit-learn but still landed up in the same error
Updated 14-Aug-22 6:45am
Richard MacCutchan 24-Oct-18 11:34am    
I guess you are trying to import a module into your Python code. However, without more information it is anyone's guess. Have you checked that sklearn exists in the correct library and/or that module is part of the package?
Member 14022594 24-Oct-18 11:47am    
yes everything i checked everything is fine
Member 14022594 24-Oct-18 11:48am    
model_selection is working fine but cross_validation im getting the error
Richard MacCutchan 24-Oct-18 12:08pm    
Sorry but you have not provided any useful information that would give us any clue what the problem is.

For Sklearn 18 version import this:
"from sklearn.cross_validation import KFold"

For sklearn 20 import this:
"from sklearn.model_selection import KFold"
Share this answer
Share this answer
cross_validation is no longer supported. Use only sklearn.model_selection from now on.
Share this answer
Member 14815208 27-Apr-20 15:29pm    
thank you
however the "cross_validation" name is now deprecated and was replaced by "model_selection" inside the new anaconda version.
Therefor you might get a warning of even an error.
To avoid this, you just need to replace:

from sklearn.cross_validation import train_test_split

from sklearn.model_selection import train_test_split
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900