Chapter 8: Clustering
Discover hidden structure in unlabeled data through unsupervised learning. Master K-Means for partitioning, hierarchical methods for building cluster trees, density-based DBSCAN for arbitrary shapes, and learn to evaluate cluster quality without ground truth.
Chapter Overview
Clustering is the quintessential unsupervised learning task: finding natural groupings in data without any labels to guide us. Unlike supervised learning where we have ground truth, clustering must discover structure purely from the data itself.
The applications are everywhere: segmenting customers by behavior, grouping similar documents, detecting anomalies that don't fit any cluster, compressing images by grouping similar colors, and exploring high-dimensional data by identifying natural categories.
Different clustering algorithms make different assumptions about what constitutes a "cluster." K-Means assumes clusters are spherical and roughly equal-sized. Hierarchical methods build trees that can be cut at any level. Density-based methods like DBSCAN find clusters of arbitrary shape and automatically identify outliers.
Choosing the right algorithm and parameters requires understanding these assumptions and evaluating results. Unlike classification, we can't simply measure accuracy. Instead, we use metrics like silhouette score that measure how well-separated clusters are, or domain knowledge to assess whether discovered groups are meaningful.
This chapter covers:
- K-Means: Fast partitioning algorithm that iteratively assigns points to nearest centroids
- Hierarchical: Bottom-up or top-down methods that produce dendrograms showing cluster relationships
- DBSCAN: Density-based algorithm that finds clusters of any shape and identifies noise points
- Evaluation: Metrics like silhouette score and methods like the elbow plot to assess clustering quality
Chapter Roadmap
Click any topic to jump in
K-Means Clustering
Partition data into K spherical clusters by iterating between point assignment and centroid updates.
Hierarchical structure and arbitrary-shape density clusters
Hierarchical Clustering
Build a dendrogram by progressively merging clusters — cut at any level for different granularities.
DBSCAN
Find clusters of arbitrary shape using density, and automatically identify noise points as outliers.
Sign up to unlock this chapter
This chapter is part of PixelBank Premium. Create a free account, then upgrade to read the full lesson — concepts, walkthroughs, and exercises.