K Means Example

K-Means is a clustering algorithm that groups n observations into k groups. It works well for well-clustered data, and is a great choice if you know the number of groups beforehand. Be aware that k-means solves for local optima (instead of global), so different iterations may yield different clusters. Also, because the algorithm clusters based on mean points with euclidian distance, it roughlyexpects clusters to be roughly spherical and of even sizes (see Cirlces and Moons below for examples where these expecations aren't met).