How does clustering work?
Google describes clustering as an unsupervised machine learning technique designed to group unlabeled examples by similarity [1]. That means first defining a similarity measure, the metric used to compare samples, in terms of the dataset's features [1]. Once the grouping is done, each group gets a unique label called a cluster ID [1].
Which algorithms are used?
The best known is k-means, which tries to split samples into n groups of equal variance by minimising a criterion called inertia, the within-cluster sum of squares; it needs the number of clusters up front [2]. DBSCAN instead treats clusters as dense areas separated by sparse ones, so its clusters can take any shape, whereas k-means assumes they are convex [2]. scikit-learn also offers hierarchical and spectral clustering, mean-shift, Gaussian mixtures and BIRCH, among others [2].
Where is it used?
Google lists market segmentation, social network analysis, search result grouping, medical imaging, image segmentation and anomaly detection [1]. A retailer, for example, might group customers by buying behaviour and plan a separate campaign for each group. A cluster ID can also stand in for other features of every example in that cluster, which saves storage and processing [1]. And tying user data to cluster IDs rather than user IDs offers some privacy protection, as long as each cluster holds enough users [1].