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

Problem reporting error:

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

Positioning problem:
According to the path search of the module, the samples_generator was not found.
The main reasons are:
1. The samples_generator module has been removed in the new version of scikit-learn.
2. The corresponding classes/functions that need to be used can be imported directly from sklearn.datasets.

Solution
1 Import make_blobs directly from sklearn.datasets

from sklearn.datasets import make_blobs

2 version problem, lower the version

pip install scikit-learn==0.22.1

Guess you like

Origin blog.csdn.net/q4326rgeqaadfd/article/details/128627718