Matrix Factorization
Content-based filtering needed someone to tag every item; collaborative filtering threw the tags away. Matrix factorization invents the attributes — it assumes a handful of hidden latent features explain every rating, learns them from the URM, and makes a prediction a dot product. The rating matrix becomes a product of two skinny matrices.
01 · Invent the attributes
Latent factors
If we knew each user’s taste and each item’s make-up, a rating would be a dot product.
Suppose we knew, for each user, how much they like each actor, and for each film, how strongly each actor features in it. Then a user’s rating of a film would be the dot product of her taste vector with the film’s actor vector. We don’t have those tables — so MF’s leap is to stop needing them: assume hidden latent factors (also called embeddings) drive behaviour, and learn them from the URM alone. Each user gets a vector and each item a vector ; the prediction is .
Content-based (Ch. 4)
Matrix factorization (Ch. 8)
The factors organise themselves
Nobody tells MF that “action” and “romance” exist — yet after training, the action fans and films land in one region of the latent space and the romance crowd in another (you’ll see it in §8.3). MF rediscovers the catalogue’s taste structure as geometry, purely from who rated what.
02 · R ≈ X · Y
Factorizing the rating matrix
Two skinny matrices, one MSE objective, and a single knob: the number of factors K.
Stack the user vectors into a user–feature matrix () and the item vectors into a feature–item matrix (). Their product reconstructs the whole rating matrix at once, , and we choose to minimise the squared error on the observed ratings — the same MSE objective as SLIM, now over two factor matrices.
R ≈ X·Y · slide the number of factors K
The reconstruction R̂ = X·Y. Each cell is the predicted rating. Raise K and the predictions snap onto the real ratings — but the parameter count grows and large K memorises noise.
This model has only parameters — for a real catalogue, far fewer than item-based CF’s similarity matrix. The single hyperparameter (commonly 10–200) controls everything: at the model collapses toward Top-Popular; too large and it overfits and stops scaling.
More factors is not more accurate
A large drives training error toward zero but overfits (and scales badly); a tiny under-personalises and tilts toward popular items. is tuned on validation (Ch. 3) — the sweet spot is an inverted-U, exactly like in KNN.
Formal Definition 8.1 — objective & parameters
Parameter count , controlled by .
03 · Two coupled gradients
Learning the factors
The error is bilinear in X and Y, so we descend on both, alternately or together.
The objective can’t be solved in closed form — it’s degree-4 in the parameters. So we use gradient descent: sample an observed rating , compute the error , and nudge both factor vectors. The two gradients are coupled — the update to uses and vice versa — which is the whole reason the problem is non-convex.
Train MF (K=2) · watch the latent space organise
The two gradients are coupled — the update to x_u uses y_i and vice versa — so the problem is non-convex. Slide the iterations and watch the loss fall and the clusters emerge.
Two ways to run this descent. Alternating Least Squares fixes and solves for (now a convex least-squares problem), then fixes and solves for , back and forth. Plain SGD just steps both at once on sampled ratings. Either way, regularization keeps the factors from exploding.
Formal Definition 8.2 — gradients & update
For an observed rating with error :
Each gradient depends on the other matrix — that coupling is what makes the problem non-convex.
04 · One idea, several models
Funk SVD, SVD++ & Asymmetric SVD
The same factorization, three refinements — and a recurring honesty about missing data.
The classic recipe is Funk SVD (Simon Funk, 2006 — and, the slides insist, it has nothing to do with the Singular Value Decomposition). It minimises the error on the observed ratings only — the missing-as-random assumption.
Funk SVD recommender · scores from learned factors
Unseen items scored by the dot product of the user's taste vector with each item's feature vector. More factors sharpen the personalization.
Bob rated: TopGun (4), MI (5), Inter (4), LoveAct (1), Aveng (5)
Two evolutions build on it. SVD++ adds the global effects from Chapter 2 — — so the factors model only what’s left after the average, the user’s generosity and the item’s popularity are removed. It was a centrepiece of the Netflix-Prize-winning ensemble, yet never shipped: it optimises MSE under missing-as-random, poor for Top-N. Funk SVD and SVD++ share a flaw: they are not model-based — a brand-new user has no factor row until you retrain. Asymmetric SVD fixes this by defining the user’s factors as a function of the items they interacted with, . It’s called “asymmetric” because the product behaves like a non-symmetric item–item similarity matrix — quietly turning MF back into an item-based model in the spirit of SLIM.
Missing-as-random is MF's Achilles' heel
By fitting only the observed cells, Funk SVD / SVD++ never learn that an un-interacted item should probably score low. They’re great at rating prediction but weak at Top-N, where the un-rated items are exactly what we must rank. This is the gap BPR (Ch. 7) and PureSVD (next) attack from opposite directions.
Formal Definition 8.3 — SVD++ & Asymmetric SVD
05 · The one that really is SVD
PureSVD & the unifying view
A truncated SVD of the URM — and the punchline that ties this whole part together.
PureSVD is the one method here that genuinely uses the Singular Value Decomposition, . The trick is to truncate it to the largest singular values: by the Eckart-Young–Mirsky theorem, the truncated SVD is the best possible rank- approximation of under the Frobenius norm. We set and — user and item factors, for free.
Why truncate? A full-rank SVD reconstructs exactly — missing entries and all — which is useless overfitting, the same trap as SLIM’s . The approximation error of a truncated SVD is what forces the model to generalise. Because the Frobenius norm sums over every cell, PureSVD treats the blanks as zeros — the missing-as-negative assumption, the opposite of Funk SVD.
All roads lead to R·S
By “folding in,” PureSVD is equivalent to item-based CF with : the prediction is . So PureSVD (Ch. 8), Asymmetric SVD (Ch. 8), SLIM (Ch. 6) and neighbourhood item-CF (Ch. 5) are all the same model — — differing only in how they obtain : a cosine, a regression, or a low-rank projection. Matrix factorization is just another way to learn that .
Formal Definition 8.4 — PureSVD & folding-in
Eckart–Young–Mirsky: the truncation is optimal, with error equal to the next singular value .
06 · Exam intel
What the exam tests
Write the MF prediction and objective; count parameters; compute a gradient step; and distinguish Funk SVD (missing-as-random, observed only) from PureSVD (missing-as-negative, real truncated SVD, ).
Worked question — predict, step, count
A user factor is and an item factor is . (a) Predict the rating; (b) the true rating is 3 — with pure MSE, one gradient step on at ; (c) parameters for .
- (a) .
- (b) error ; gradient ; update (it rises — the prediction was too low and the item loads on feature 1).
- (c) parameters.
Traps: thinking Funk SVD is the SVD (a misnomer); saying bigger is always better (it overfits); forgetting the gradients are coupled, or that Top-Popular.
07 · Exam · past papers
Past-paper questions
Past paper Practice Exam 1 · MF idea, learning, regularization
Q. The idea behind MF; how parameters are learned with a loss like MSE; how regularization prevents overfitting and its impact.
Model answer. Idea. Approximate the URM by , where is a user’s latent vector and an item’s; score . Learning. Fit only the observed entries : , via SGD or ALS. Regularization. The term penalises large factor norms (users/items with few ratings would otherwise overfit). It shrinks magnitudes — it does not sparsify the dense factor matrices.
Past paper Practice Exam 4 · Funk SVD vs full SVD, and ALS
Q. Funk SVD’s main idea and how it differs from full SVD; its missing-data assumption; iterative training via ALS.
Model answer. Funk SVD vs full SVD. Full SVD needs a complete matrix and is expensive; on a sparse URM you’d have to impute the blanks (biasing the result). Funk SVD instead learns directly by gradient descent on the observed ratings only — “SVD-like” but optimisation-based, not an exact decomposition. Missing data. It treats blanks as unknown, not 0: the loss sums only over observed , so unrated items exert no pull toward zero. ALS. The objective is bi-convex: with fixed, each is a regularised least-squares solve with a closed form; then fix and solve each . Alternate until convergence; each half-step is exact and parallelises.
08 · Self-check
Three questions before you move on
In matrix factorization, the latent factors are:
A matrix factorization model with N users, M items and K factors has how many parameters?
Which statement about Funk SVD vs PureSVD is correct?
09 · Recap
One-screen summary
Chapter 08 — load-bearing ideas
- Factorize: , . The latent features are learned, not given; parameters.
- Learn by gradient descent: minimise MSE over observed ratings with coupled gradients (ALS or SGD) + L2 regularization; is the capacity knob.
- A family, one core: Funk SVD (observed only), SVD++ (+global effects), Asymmetric & PureSVD — all reduce to , differing only in how is found.
- Missing-as-random (Funk SVD) vs missing-as-negative (PureSVD); Top-Popular.