Skip to content

Day 02 — Part 2: Clustering Techniques

Every company wants to segment its users. Every fraud team wants to flag anomalies. Clustering is the toolbox that makes both possible — without needing a single label.

This session covers the three most practical clustering algorithms (K-Means, Hierarchical, DBSCAN), how to evaluate results when you have no ground truth, and the scaling and visualisation habits that separate production-ready analysis from homework.

Session Overview

Difficulty: Intermediate Reading time: ~2 hours | Exercises: ~1.5 hours Prerequisites: NumPy distance operations · Pandas groupby · Basic statistics (mean, variance) · Matplotlib scatter plots · Feature scaling concepts

Info

Prerequisites: Python, NumPy, Pandas, basic sklearn. Week 01 material on feature scaling is directly relevant here.


Session Map

# Topic What you will learn
1 01-clustering-overview What clustering is, when to use it, algorithm selection
2 02-k-means K-Means algorithm, k-means++, elbow method, silhouette criterion
3 03-hierarchical-clustering Agglomerative clustering, linkage methods, dendrograms
4 04-dbscan Density-based clustering, parameter tuning, outlier detection
5 05-evaluation-and-scaling Silhouette score, Davies-Bouldin, scaling, PCA visualisation
6 06-exercises Customer segmentation, shape comparison, silhouette search

Estimated Time

Component Time
Reading all notes 60–75 min
Running code examples 30 min
Exercises (warm-up + main) 45 min
Stretch exercise 30 min
Total ~3 hours

Difficulty: Intermediate. The concepts are intuitive; the challenge is knowing which algorithm to pick and how to interpret results that have no clear "correct" answer.


The Core Tension in Clustering

Clustering gives you confident-looking results no matter what. K-Means will always return exactly k groups. DBSCAN will always label some points as outliers. Hierarchical will always produce a tree.

The hard part is not running the algorithm. It is deciding whether the result is meaningful or an artifact of your parameters, your scale, or your data's shape.

Keep that in mind throughout the session.


Start here: 01-clustering-overview