Clustering I

k-means and cluster evaluation

Published

October 16, 2026

k-means and Lloyd’s algorithm; hierarchical clustering and linkage; choosing the number of clusters with the elbow, the silhouette, and the gap statistic.

📖 Assigned reading: ISLR §10.3


📊 Slides

🧪 Labs

Live, in-browser R lab — runs entirely in your browser via webR, no local R install needed.

  • 🧪 Lab: Thyroid patients (live R) — edit and re-run any code cell: k-means and hierarchical clustering on five thyroid lab tests, with the silhouette and gap statistic for choosing K. A “Download my code” button captures whatever you’ve written before you leave.