Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 893
PineNuts0 Avatar asked Apr 25 '17 01:04

PineNuts0


2 Answers

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

like image 58
acbetter Avatar answered Oct 03 '22 23:10

acbetter


Try this for python3

pip3 install -U scikit-learn
like image 30
TechJ Avatar answered Oct 03 '22 23:10

TechJ