Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to plot kmeans graph

import matplotlib.pyplot as plt 
from sklearn.cluster import KMeans 
%matplotlib inline
kmean_model = KMeans(init='k-means++')
kmean_model.fit(df)
predict = kmean_model.predict(df)

plt.scatter(df.iloc[:,2],df.iloc[:,3],c = predict,cmap = 'viridis')
 
PREVIOUS NEXT
Tagged: #plot #kmeans #graph
ADD COMMENT
Topic
Name
1+4 =