Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to plot kmeans centroids


#assuming we trained and saved the model in 'kmean_model' obj 
predict = kmean_model.predict(df)
plt.scatter(df.iloc[:,2],df.iloc[:,3],c = predict,cmap = 'viridis')
plt.scatter(kmean_model.cluster_centers_[:,2],kmean_model.cluster_centers_[:,3],c='red',marker = 'x')
 
PREVIOUS NEXT
Tagged: #plot #kmeans #centroids
ADD COMMENT
Topic
Name
4+1 =