How many centroids would a k-means algorithm with k = 3 find?
3
3
Card 1 of 259. Answer: 3
About · Quizzes · History of AI · To suggest new questions or report an error send me a dm.
Three. In k-means k is the number of clusters, and each cluster is represented by one centroid, the mean of its points. With k = 3 the algorithm returns three centroids, and each point joins the cluster of the nearest one.
Lloyd's algorithm alternates two steps: assign each point to its closest centroid, then move each centroid to the mean of its points. For the points 1, 2, 9, 10, 20 and 22 with starting centroids 1, 9 and 10, the first pass gives {1, 2}, {9} and {10, 20, 22}, moving the centroids to 1.5, 9 and 17.3. The next gives {1, 2}, {9, 10} and {20, 22}, with centroids 1.5, 9.5 and 21, and then nothing changes.
None of these centroids is a data point; k-medoids uses actual points instead. K-means only finds a local minimum of the within-cluster sum of squares, so the result depends on the start; libraries use k-means++ seeding and several restarts. Fewer than three distinct points cannot form three distinct clusters.