Matrix Factorization Fundamentals
What you'll learn: How to decompose a sparse rating matrix into hidden user and item features that capture latent patterns in preferences.
The Core Idea
Imagine you're trying to understand why users like certain movies. Instead of storing every rating explicitly, matrix factorization discovers hidden features — like "how much does this user enjoy action?" or "how action-packed is this movie?" — without anyone labeling them.
Matrix factorization takes your original rating matrix (users × items) and breaks it into two smaller matrices:
- A user matrix (users × k features)
- An item matrix (items × k features)
When you multiply these two matrices back together, you approximate the original ratings — plus predict missing ones.
Why This Works
The key insight: most users don't rate items randomly. Hidden patterns drive preferences. A user who loves "The Matrix" probably enjoys sci-fi generally, even if we never explicitly tagged movies as "sci-fi."
By forcing all ratings through a bottleneck of k latent factors (typically 10-100), the model learns compressed representations that capture these patterns. Each user gets a vector describing their preferences along hidden dimensions, and each item gets a vector describing its characteristics along those same dimensions.
The Mathematical View
If R is your rating matrix, you decompose it as: R ≈ U × I^T
Where U is the user latent factor matrix and I is the item latent factor matrix. The dot product between a user's feature vector and an item's feature vector predicts that rating.
Key Takeaway: Matrix factorization transforms sparse rating matrices into dense, low-dimensional representations that capture hidden preference patterns, enabling accurate predictions for unrated items through learned user and item embeddings.