What is k-means clustering?

A representative clustering method that divides data into a predetermined number k of clusters. It places k tentative centers, then repeats assigning each data point to the cluster of the nearest center and moving each center to the mean of its cluster's data until the assignments stop changing. It is simple to compute and works on large data, but the result depends on the initial centers, k must be chosen by the user, and clusters that are not roughly spherical are hard to separate.

Japanese name: k平均法

k-means clustering appears in 1 practice question across 1 topic, including Machine Learning Basics.

Field: Machine Learning Basics

Try it: questions about k-means clustering

Which of the following describes the procedure of clustering with k-means (k-means clustering)?

  1. AStart with all data in one cluster and split off the data farthest from the rest one by one, dividing until there are k clusters
  2. BPlace k tentative centers, assign each data point to the cluster of the nearest center and make each cluster's mean the new center, repeating until the assignments stop changing
  3. CFor each point to be clustered, find the k nearest points in the training data and decide its cluster by a majority vote of their labels
Show answer and explanation

Answer: B. Place k tentative centers, assign each data point to the cluster of the nearest center and make each cluster's mean the new center, repeating until the assignments stop changing

k-means fixes the number of clusters k in advance and works as follows: (1) choose k centers, (2) assign each data point to the cluster of the nearest center, (3) make the mean of each cluster's data its new center, and repeat (2) and (3) until the assignments stop changing. The result depends on the initial centers and can stop at a solution that is not the best partition, so the algorithm is run several times with different initial values, or an initialization such as k-means++ is used. The value of k is not determined automatically, so it is chosen with guides such as the elbow method.

k-means clustering in the explanations

Questions that mention k-means clustering (1)

  1. Which of the following describes the procedure of clustering with k-means (k-means clustering)?

Books on Machine Learning Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

Activation function Confusion matrix Convolutional neural network (CNN) Cross-validation Gradient descent Overfitting Precision and recall Principal component analysis (PCA) Recurrent neural network (RNN) Regularization

Back to the glossary