Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.3K
Visualizações
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_blobs

data, _ = make_blobs(n_samples=300, centers=4,
                     cluster_std=0.60, random_state=0)

Error:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-f93335003f84> in <module>
      1 # Generate 4 clusters of random data.
----> 2 from sklearn.datasets.samples_generator import make_blobs
      3 
      4 data, _ = make_blobs(n_samples=300, centers=4,
      5                      cluster_std=0.60, random_state=0)

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

I have tried: pip install sckit-learn and pip install sckit-datasets

I have Anaconda 3, python 3.6 and PythonAdv environments on Git Bash on Windows.

over 4 years ago · Hanz Gallego
2 Respostas
Responde à pergunta

0

Try using pip3

pip3 install -U scikit-learn
over 4 years ago · Hanz Gallego Relatório

0

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.datasets import make_blobs

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

over 4 years ago · Hanz Gallego Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda