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
| Classification | Clustering |
|---|---|
| Uses labels | No labels |
| Predict class | Discover structure |
| Supervised | Unsupervised |
π 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.