โ† Machine Learning Primer

Unsupervised Learning

~330 words ยท 2 min read

Finding structure without labels

Unsupervised learning works with data that has no labeled answers. The goal is to discover hidden structure โ€” groups, patterns, or a simpler representation โ€” rather than predict a known target.

The key difference from supervised learning

Supervised learning has labeled examples: (features โ†’ known answer). Unsupervised learning has only features; the algorithm must infer the structure itself. There is no "ground truth" to check against, which makes evaluation trickier and more subjective.

Clustering

Group similar items together. The flagship algorithm is k-means:

1. Pick k (the number of clusters you want).
2. Place k random centroids.
3. Assign each point to the nearest centroid.
4. Move each centroid to the mean of its points.
5. Repeat 3โ€“4 until centroids stabilize.

Use cases: customer segmentation, document grouping, anomaly detection (points that fit no cluster).

k-means always converges, but it finds a local optimum โ€” run it several times with different starting centroids and keep the best.

Dimensionality reduction

Compress many features into fewer while preserving the important structure. PCA (Principal Component Analysis) finds the directions of greatest variance and projects data onto them.

  • Visualize high-dimensional data in 2D or 3D.
  • Speed up downstream models by removing redundant features.
  • Reduce noise.