ML Foundations
Back to Evaluation, Leakage, and Unsupervised

Clustering and Dimensionality Reduction

Unsupervised: find structure without labels. The four most-used techniques. FIND_VIDEO: search 'k-means hierarchical PCA UMAP' — recommended channel: StatQuest. Aim for 11 min or under.

8 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. K-Means Introduction — K-means is an unsupervised algorithm designed to partition data into defined groups.
  2. Initialization Step — Select K and randomly choose K distinct data points as initial cluster centers.
  3. Assignment Process — Data points are assigned to the nearest centroid based on measured distance.
  4. Recalculation and Stop — New centroids are calculated as the mean of assigned points until assignments stabilize.
  5. Quality Assessment — WCSS measures total variation within clusters; run multiple times to find the lowest WCSS.
  6. Optimizing K — The Elbow Method plots WCSS vs K to find the point of diminishing returns.
  7. K-Means vs Hierarchical — K-Means requires a fixed K, unlike Hierarchical Clustering which determines similarity pair-wise.
  8. N-Dimensional Data — The generalized Euclidean distance allows K-Means to cluster data in any number of dimensions.
PDF notes

Frequently asked questions

Why is K-Means considered unsupervised learning?

It finds structure (clusters) in data without requiring pre-labeled training examples or target variables.

What is the stopping condition for the K-Means algorithm?

The algorithm stops when the cluster assignments of the data points no longer change between iterations.

Does K-Means work if my data has 50 features?

Yes, K-Means uses the generalized Euclidean distance formula, which works regardless of the number of dimensions (N).

What does n_init=10 do in scikit-learn's K-Means?

It runs the algorithm 10 times with different random initializations and returns the best result (lowest WCSS).

How was this lesson?

Your feedback helps us refine explanations and catch bugs.