My port of a K-means clustering algorithm from Andrew Ng's machine learning course.