Search
 
SCRIPT & CODE EXAMPLE
 

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')
Comment

PREVIOUS NEXT
Code Example
Python :: how to define functions in python 
Python :: pandas series top 5 percent 
Python :: replace string between two regex python 
Python :: python filter() 
Python :: how to revert a list python 
Python :: swapping in python 
Python :: python chat 
Python :: pandas datetime to unix timestamp 
Python :: power of array 
Python :: len(sys.argv) == 2 
Python :: create python executable 
Python :: jinja if or 
Python :: flatmap in python 
Python :: getting input in python 
Python :: python access each group 
Python :: while loop py 
Python :: django sign up 
Python :: pandas write image to excel 
Python :: two groupby pandas 
Python :: display pandas dataframe with border 
Python :: appending objects to a list contained in a dictionary python 
Python :: check runtime python 
Python :: python replace one character into string 
Python :: pickling python example 
Python :: numpy concatenation array 
Python :: web driver module in python 
Python :: list pakages installed in python 
Python :: python datetime floor to hour 
Python :: return mean of df as dataframe 
Python :: python list contains string 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =