Glossary · Data Science & AI
K-Means Clustering
Also called: k-means · Lloyd's algorithm
An unsupervised algorithm that groups observations into k clusters by repeatedly assigning each point to the nearest cluster center and recomputing the centers.
Definition
K-means clustering partitions data into a chosen number k of groups so that the total squared distance between points and their cluster's mean is as small as possible. The standard procedure, often attributed to Stuart Lloyd and named k-means by James MacQueen in 1967, alternates between assigning points to the nearest center and moving each center to the mean of its points until assignments stop changing. Variables should be standardized first so that ones with large units do not dominate, and the result depends on the starting centers and the choice of k. In marketing it is a common first step in needs-based or behavioral segmentation.
Formula
TeX source
\min_{S_1,\dots,S_k} \sum_{j=1}^{k} \sum_{x_i \in S_j} \lVert x_i - \mu_j \rVert^2Worked example
Try it in a tool
- Statistics ToolkitHypothesis tests, confidence intervals, sample-size and power planning, regression-output interpretation and a normal/t/chi-square/F calculator.
- Marketing Analytics ToolkitCustomer lifetime value, break-even and price-cut volume, price elasticity with Lerner pricing, and a conjoint part-worth and share simulator.
Related terms
- Unsupervised Learning: Machine learning that finds structure, such as groups or underlying dimensions, in data that has no labeled outcome.
- Market Segmentation: Dividing a market into groups of customers whose needs or responses to marketing differ enough to justify different offers.
- Machine Learning: Methods that let computers learn patterns from data to make predictions or decisions without being explicitly programmed with rules.
- Standard Deviation: A measure of how spread out values are around their mean, in the same units as the data.