k-means clustering is a neat way to find ‘centers of density’ in a group of points. It’s useful for applications like finding natural groups, simplifying visualizations, and summarizing data. There are plenty of libraries that implement the algorithm in Javascript, R and more. While I’ve been working on an implementation with some interesting properties, this article is about understanding the alg