Post

Unsupervised Learning

Unsupervised Learning

🧠 Unsupervised Learning & Clustering

Lecture-style structured notes with intuition, examples, and math


πŸ“Œ Why Unsupervised Learning?

🎯 Goal

Unsupervised learning aims to discover interesting structure in data without labels.

  • πŸ” Discover subgroups / patterns among observations or variables
  • πŸ“Š Find informative ways to visualize high-dimensional data

πŸ’‘ Why is it important?

  • Unlabeled data is easier and cheaper to obtain
  • Labeling requires human labor & expertise

⚠️ Key Characteristic

  • No single objective like prediction accuracy
  • Results are often subjective

🧩 Clustering Problem

πŸ“– Definition

Finding natural groupings among objects.

βœ… Objective

  • High intra-cluster similarity
  • Low inter-cluster similarity

πŸ§ͺ Clustering Examples

🧬 Gene Clustering

  • Microarrays measure gene activity across conditions
  • Similar expression patterns β†’ clustered genes
  • Helps infer functions of unknown genes

πŸ‘€ User Clustering (Recommendation Systems)

  • Core idea of collaborative filtering
  • Users with similar tastes are grouped

β€œUsers like you also liked …”


πŸ–ΌοΈ Image Compression

Each pixel is a vector: \(\mathbf{x}_i = [R_i, G_i, B_i]^T\)

Cluster centers: \(\{\mu_1, \mu_2, \dots, \mu_K\}\)

Assignment: \(\arg\min_k \| \mathbf{x}_i - \mu_k \|_2\)

Fewer colors β†’ smaller storage size


πŸ†š Classification vs Clustering

ClassificationClustering
Uses labelsNo labels
Predict classDiscover structure
SupervisedUnsupervised

🎭 Clustering is Subjective

There is no single correct clustering.

Possible groupings:

  • Family-based
  • Gender-based
  • Occupation-based

Depends on similarity definition.


πŸ“ Similarity / Distance Metrics

L1 Distance

\(L_1(A,B) = \sum_{i,j} |A_{ij} - B_{ij}|\)

L2 Distance

\(L_2(A,B) = \sqrt{ \sum_{i,j} (A_{ij} - B_{ij})^2 }\)

Distance Matrix

\(D = \begin{bmatrix} 0 & d_{12} & d_{13} \\ d_{21} & 0 & d_{23} \\ d_{31} & d_{32} & 0 \end{bmatrix}\)


🧱 Two Types of Clustering

🌲 Hierarchical Clustering

  • Bottom-up (agglomerative)
  • Produces a dendrogram

πŸ“¦ Partitional Clustering

  • Top-down
  • Requires number of clusters K
  • Example: K-means

🧠 Summary

  • Unsupervised learning finds structure without labels
  • Clustering is the most common technique
  • Results depend on:
    • Distance metric
    • Number of clusters
    • Interpretation goal
This post is licensed under CC BY 4.0 by the author.