6 Clustering
Learn how clustering groups unlabeled examples, how common clustering methods differ, and how to assess whether their results are useful.
What does
is an task: an algorithm groups examples according to similarities in their features, without being given the correct group labels in advance. In , by contrast, a model learns to assign examples to predefined labels.
may reveal useful structure, but it does not automatically explain what each group means. People interpret the resulting groups in context.
Examples and applications
A store could represent each customer using features such as visit frequency and average purchase amount. A algorithm might group customers with similar shopping patterns; the business could then inspect the groups and decide whether they correspond to occasional shoppers, regular customers, or another useful pattern.
can also support document and search-result grouping, image analysis, and exploratory analysis. For example, grouping pixels or regions with similar properties can support image segmentation. In scientific, health, or operational data, may help identify patterns, unusual examples, or potential subgroups.
Text documents can be converted into feature vectors and clustered to discover groups of related topics. Such groups can help people explore a collection, but they should not be treated as definitive categories without review.
Features and similarity
A method uses a , or equivalently a distance measure, to decide which examples are alike. The appropriate measure depends on the features and the task.
Features with larger numerical scales can dominate distance calculations. Data often needs to be scaled or transformed before . Because algorithms define clusters differently, they can produce different groupings from the same data.
How methods differ
assigns examples to the nearest of a chosen number of centers, then updates the centers and repeats. It is efficient for compact, roughly round clusters, but requires choosing the number of clusters and can be affected by outliers or its starting centers.
builds a hierarchy of groups. In an agglomerative approach, each example starts alone and the closest groups are repeatedly merged. The resulting tree can be cut at different levels to obtain different numbers of clusters.
groups examples in dense regions and can mark isolated examples as noise. It can find irregularly shaped clusters, but its results depend on settings such as neighborhood radius and minimum neighborhood size.
represent data as a mixture of probability distributions. Rather than assigning each example only to one group, they can estimate its probability of belonging to each cluster.
These methods rely on different assumptions and suit different data shapes. No single method is best for every dataset.
Interpreting and evaluating clusters
A cluster is a pattern produced under a particular choice of features, distance measure, and algorithm; it is not necessarily a naturally existing or meaningful category. Consider whether the groups are useful for the intended task, whether results change substantially with different settings, and whether the examples grouped together make sense.
If known labels are available, they can help compare clusters with those labels. Without labels, evaluation is less direct and may use measures such as the alongside practical review.