Sklearn.linear_model not found in TensorFlow Udacity course

I follow the instructions of the Deep Learning course from Google using TensorFlow. Sorry, I'm stuck with this book right now. I work in docker vm with all destination code loaded as described here .

When I do all the imports, everything works, except for the following line:

from sklearn.linear_model import LogisticRegression 

it produces the following error:

 >>> from sklearn.linear_model import LogisticRegression Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named sklearn.linear_model 

This SO answer sounds promising, but I did not find the source sklearn directory.

Any help is greatly appreciated.

+5
source share
3 answers

You can install and update sklearn from the shell using pip. This may or may not be a problem, but at least you will find out that it is installed.

 sudo pip install --upgrade scikit-learn 
+7
source

In your Jupyter laptop:

 import pip pip.main(['install', 'sklearn']) 
+2
source

Note that when you write your code, you import the sklearn package using import sklearn , but when installing the package, say conda, you should do the following:

conda install scikit-learn

0
source

Source: https://habr.com/ru/post/1242158/


All Articles