K-means find clusters

Initial set of two dimensional data and k=3. Set initial centroids randomly.

Screen Shot 2015-08-18 at 14.30.35

 

Find instances to closest centroids

Screen Shot 2015-08-18 at 14.31.33

Calculate new positions for centroids

Screen Shot 2015-08-18 at 14.35.33

Find again closest instances to centroids

Screen Shot 2015-08-18 at 14.36.42

Calculate again new position of centroids

Screen Shot 2015-08-18 at 14.38.49

Find again closest instances to centroids

Screen Shot 2015-08-18 at 14.40.09