A simple Kmeans Cluster code using python that randomly initialize points and centroids, then cluster the points to the nearest centroids using the kmeans cluster algorithm .
This code uses matplotlib library to plot the output of each iteration until the converge occured
You can change the number of randomly generated points, centroids and the max-min x and y values by modifying the next line of codes
POINTS_NUM = 25
CENTROIDS_NUM = 4
X_MIN = 0
X_MAX = 50
Y_MIN = 0
Y_MAX = 50.