Wizard Book


Programming Python, Web, Android

Python: K-Means Clustering Menggunakan Sklearn

Proses Data Mining Clustering Metode K-Means sangat mudah dan cepat menggunakan Sklearn

from sklearn.cluster import KMeans

data = [[1, 3],
        [3, 3],											
	[4, 3],											
	[5, 3],											
	[1, 2],											
	[4, 2],											
	[1, 1],											
	[2, 1]]

n_clusters=3

clusterer = KMeans(n_clusters=n_clusters, random_state=10)
cluster_labels = clusterer.fit_predict(data)

print(cluster_labels)

email : contohprogram.com@gmail.com
WA : +6289671400363