PineNuts0
PineNuts0

Reputation: 5234

Python 3: No module named 'sklearn.model_selection'

I am trying to learn Neural Networks via the Keras Deep Learning Library in Python. I am using Python 3 and referencing this link: Tutorial Link

I try to run the code below but get the following error:

ImportError: No module named 'sklearn.model_selection'

import numpy
import pandas

from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline

Any help is greatly appreciated!

Upvotes: 6

Views: 34686

Answers (3)

TechJ
TechJ

Reputation: 512

Try this for python3

pip3 install -U scikit-learn

Upvotes: 3

Ashish Thosar
Ashish Thosar

Reputation: 31

This command works for me in ubuntu and Python 2:

sudo apt-get install python-sklearn 

For Python 3 use this command:

sudo apt install python3-sklearn 

Upvotes: 2

acbetter
acbetter

Reputation: 196

I think you install wrong version of sklearn.

Please try this: import sklearn print (sklearn.__version__) 0.17.1

If your version is below 0.18, please update with pip install -U scikit-learn or pip3 install -U scikit-learn

If you have import Error, please install sklearn with pip install scikit-learn or pip3 install scikit-learn

Upvotes: 6

Related Questions