The KMeans algorithm. By applying KMeans on the database of 2D points, (1) KMeans will first load the database of 31 points in memory. Then, assume that the user has set K = 3 to generate 3 clusters. (2) KMeans will initially create three empty clusters which will have some random points as prototypes.