Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

scikit learn k means

from sklearn.cluster import KMeans
df = np.array([[1,4],[2,2],[2,5],[3,3],[3,4],[4,7],[5,6],[6,4],[6,7],[7,6],[7,9],[8,7],[8,9],[9,4],[9,8]])
kmeans = KMeans(n_clusters=3, init='k-means++', max_iter=300, n_init=10)
y_pred = kmeans.fit_predict(df)
Comment

PREVIOUS NEXT
Code Example
Python :: Get the Type 
Python :: remove alphabetic characters python 
Python :: all files in directory python 
Python :: python dataframe shape 
Python :: encryption python 
Python :: datetimes to day of year python 
Python :: python center window 
Python :: python write list to file 
Python :: pd dataframe get column names 
Python :: pandas series to numpy array 
Python :: python gaussian elimination 
Python :: python new line command 
Python :: dice rolling simulator python 
Python :: What happens when you use the built-in function any() on a list? 
Python :: How can I install XGBoost package in python on Windows 
Python :: how to print a string by reverse way in python 
Python :: how to shutdown a windows 10 computer using python 
Python :: python read line into list 
Python :: python csv 
Python :: read a file and split the words python 
Python :: how to check if file exists pyuthon 
Python :: sort list of numbers python 
Python :: python list iterate in 1 line 
Python :: pandas find location of values greater than 
Python :: python program for printing fibonacci numbers 
Python :: how to plot pie chart in python 
Python :: pyqt5 button example 
Python :: flask read form data 
Python :: delete the content from the entry form in tkinter python 
Python :: python django shell command 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =