first of all, I want to explain that I have this problem because I need to use train_ test_ Split method, the specific reference is:
from sklearn.model_selection import train_test_split
this error occurred:
ImportError: No module named model_selection
I checked on the Internet and found out the cause of the problem. One thing Dashen gave me was that there was a problem with my sklearn version, which was train before version v0.18_ test_ Split
is placed in cross_ In the validation
module, now, there are two solutions to this problem:
Method 1.
will:
from sklearn.model_selection import train_test_split
TO:
from sklearn.cross_validation import train_test_split
Method 2.
Upgrade sklearn to v0.18 or above
If your pychar compilation environment is Anaconda’s python, enter
in the anaconda prompt operation line
The CONDA update scikit learn command updates the version of sklearn. Before updating, you will be prompted to what version to update
Or enter PIP install — upgrade scikit learn to update the version
as well
Similar Posts:
- Python Error – (sklearn) ImportError: No module named cross_validation
- No module named ‘sklearn.model_selection [How to Solve]
- Problems and solutions in running tensorflow
- The solution of cannot import name mlpclassifier when using sklearn
- Pycharm introduces numpy error: ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy.
- ImportError: No module named matplotlib.pyplot
- How to Solve ModuleNotFoundError: No module named ‘sklearn.grid_search‘
- Conda Install Error: Solving environment: failed with initial frozen solve.
- [Solved] Python Anaconda reports an error. If there is no pymysql. PIP install, there is still an error when installing Jupiter
- Pyinstaller publishes exe and pops up failed to execute script main