Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 834 Bytes

File metadata and controls

17 lines (11 loc) · 834 Bytes

Simple k-Means Clustering - Python

Simple k-means clustering (centroid-based) using Python

Code Requirements

Python 3.5
Numpy 1.11.0

Description

k-Means clustering is one of the most popular clustering methods in data mining and also in unsupervised machine learning. Here is a simple technique (actually a demonstration of the algorithm) for clustering data using k-Means Clustering method (with centroid-based). This code (for now) uses iterative method but doesn't use stopping or convergence criteria.

Initialize the centroids (number and position of the centroids) in function create_centroids(). Note that, the algorithm may find suboptimal solution if the centroids are chosen badly.

The output of this code are the data points with the cluster number/label and also the final centroids position.