Last answered:

24 Jul 2023

Posted on:

20 Jul 2023

0

kmeans has different output.

Hi team,

My output is a reverse of the leacture's. I got array([1, 1, 1, 1, 1, 0]).

However, I keep getting this error "C:\Users\chiez\anaconda3\lib\site-packages\sklearn\cluster\_kmeans.py:1412: FutureWarning: The default value of `n_init` will change from 10 to 'auto' in 1.4. Set the value of `n_init` explicitly to suppress the warning
  super()._check_params_vs_input(X, default_n_init=10)
C:\Users\chiez\anaconda3\lib\site-packages\sklearn\cluster\_kmeans.py:1436: UserWarning: KMeans is known to have a memory leak on Windows with MKL, when there are less chunks than available threads. You can avoid it by setting the environment variable OMP_NUM_THREADS=1.
  warnings.warn("    whenever I run kmeans.fit()


4 answers ( 0 marked as helpful)
Instructor
Posted on:

20 Jul 2023

0

Hey Chiezie,


Thank you for reaching out!


Could you please provide a sceenshot of your code together with the error you're getting?


Kind regards,

365 Hristina

Posted on:

21 Jul 2023

0

Thank you for your reply. I have seen my mistake. I used random_state(365), I had to remove it and the code gave the right output. But, whenever I run 'kmeans.fit' I get this error. I have tried upgrading my libraries but it didn't help. Thank you

Posted on:

21 Jul 2023

0

Instructor
Posted on:

24 Jul 2023

0

Hey Chiezie,


Thank you for the screenshots!


I will assume that the rest of the code in your notebook is the same as the one in the lecture. Could you please change the line

kmeans = KMeans(1)

to

kmeans = KMeans(n_clusters = 1, n_init = 10)

Let me know if the issue persists.


Kind regards,

365 Hristina

Submit an answer