ModuleNotFoundError: No module named ‘sklearn.datasets.samples_generator‘

No module named ‘sklearn.datasets.samples_ generator’

Causes and solutions of error reporting

Problem reporting error

from sklearn.datasets.samples_generator import make_blobs


samples_ The generator module has been removed in the new version of scikit learn .

samples_ The corresponding classes/functions in the generator module can be imported directly from sklearn. Datasets .


Method 1:

Import make directly from sklearn. Datasets _ blobs

from sklearn.datasets import make_blobs

Method 2:

Version problem, reduce version

pip install scikit-learn==0.22.1

Reference: link

come on

thank you

work hard

Read More: