liveBook · Manning

Clustering

As explained in Grokking Machine Learning, Second Edition

An unsupervised learning technique that groups unlabeled data points into clusters based on similarity.

Clustering groups unlabeled data points into similar clusters. It helps reveal structure when no label tells you what each point represents, and it can also simplify data for later supervised learning. section 2.10 section 2.17

Grouping emails by visible features

Suppose an email dataset has no spam or ham labels. A clustering algorithm can group messages using features such as message words, sender, attachment count and size, or link types. In a small dataset, size and recipient count may reveal three natural groups; people can then label those groups as Personal, Social or Promotions. section 2.11

Clustering can organize data in several practical ways:

  • Group houses by location, price, size, or a combination of these features. section 2.11
  • Group images by similarity, potentially separating dogs from cats or grouping animals by breed. section 2.10
  • Reduce the number of dataset rows by combining similar rows into clusters. section 2.13
Table 2.1 A table of emails with their size and number of recipients
Email
Size
Recipients
1
8
1
2
12
1
3
43
1
4
10
2
5
40
2
6
25
5
7
23
6
8
28
6
9
26
7

Inspect the nine-email dataset, which records message size and recipient count before clustering. section 2.11

Figure 2.5 A plot of the email dataset. The horizontal axis corresponds to the size of the email and the vertical axis to the number of recipients. We can see three well-defined clusters in this dataset.

View how plotting email size against recipient count makes three clusters easier to see than inspecting rows alone. section 2.11

How Grokking Machine Learning, Second Edition covers it

How deep it goes
Defines clustering and illustrates it with housing, image, and email examples, but does not detail particular clustering algorithms.
Examples
Uses unlabeled dog and cat images, houses grouped by features, and emails grouped by size and recipient count.
What it assumes
Distinguishes labeled from unlabeled data and introduces clustering as a branch of unsupervised learning.
What you can do after
Apply clustering to organize unlabeled images, housing records, or emails by observable similarities.
How it connects
Connects clustering with unsupervised learning, supervised learning, dimensionality reduction, and preprocessing.

Also explained in

Compare how 24 books explain clustering →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning, Second Edition. The section links point to the parts of the book it draws on.