thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

AI & Machine Learning · Foundational

K-Means Clustering

An unsupervised algorithm that partitions data into k clusters by assigning points to the nearest centroid and iteratively updating centroids.

Definition

K-means starts with k initial centroids, assigns each point to the closest one, recomputes each centroid as the mean of its points, and repeats until assignments stabilize. The number of clusters k must be chosen in advance, often with the elbow method or silhouette score. It assumes roughly spherical, similarly sized clusters and is sensitive to feature scaling.

Example

Running k-means with k=5 on purchase frequency and basket size to find customer segments.

Exam tip

k in k-means is the number of clusters; k in k-NN is the number of neighbors. Exams test this confusion.

Related terms