In [56]: import pandas as pd
import numpy as np
import seaborn as sns
import [Link] as plt
data=pd.read_csv("C:\\Users\\Liki\\Onedrive\\Documents\\Mall_Customers.csv")
display(data)
[Link]()
[Link]()
x=[Link][:,[3,4]]
display(x)
from [Link] import KMeans
cs=[]
for i in range(1,11):
kmeans=KMeans(n_clusters=i,init='k-means++',random_state=42)
[Link](x)
[Link](kmeans.inertia_)
[Link](range(1,11),cs,marker='o')
[Link]("The Elbow method\n")
[Link]("Number of clusters")
[Link]("cs")
196 126 28
197 126 74
198 137 18
199 137 83
200 rows × 2 columns
C:\Users\kavee\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\kavee\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 th
e environment variable OMP_NUM_THREADS=1.
[Link](
C:\Users\kavee\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\kavee\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 th
In [ ]: