The KMeans function takes a data set and outputs the centroids of its clusters and, optionally, the clusters themselves.