Skip to content Skip to sidebar Skip to footer

No Module Named 'sklearn.datasets.samples_generator'

When trying to create 4 clusters of random data, I am getting the following error message: # Generate 4 clusters of random data. from sklearn.datasets.samples_generator import make

Solution 1:

In the latest versions of scikit-learn, there is no module sklearn.datasets.samples_generator - it has been replaced with sklearn.datasets (see the docs); so, according to the make_blobs documentation, your import should simply be:

from sklearn.datasetsimport make_blobs

As a general rule, the official documentation is your best friend, and you should definitely consult it first before anything else.

Solution 2:

Try using pip3

pip3 install -U scikit-learn

Post a Comment for "No Module Named 'sklearn.datasets.samples_generator'"