Skip to content

Matrix Factorization

Fills in a huge, mostly empty user-by-item ratings table by describing every user and every item with a few hidden taste numbers.

Also latent factor model · SVD recommender · Funk SVD · ALS

Fig. / How it works
Sparse ratings tableSparse ratings tableLearn user and item factorsLearn user and item factorsDot productDot productFill in the blanksFill in the blanks
Role · kind
Models and algorithmsModel
Level
Intermediate

Koren, Bell and Volinsky, 2009

Maybe every movie is secretly a mix of 'action', 'romance' and 'comedy', and every viewer has a liking for each. Learn those hidden numbers and you can guess how anyone will rate anything.

Where it fits

+All relationships as a list

Is a kind of / part of

See it on the full map

How it works

Picture a table with one row per user and one column per movie, filled with star ratings. Almost all cells are empty: nobody has seen more than a tiny fraction of the catalog. A recommender system has to guess the empty cells.

Matrix factorization assumes the table has a simple hidden structure. Each movie is described by a few numbers (say, how much action, romance, comedy it has) and each user by how much they like each of those. A predicted rating is just the user’s numbers times the movie’s numbers, added up: a dot product of two embeddings.

The model is never told what the factors mean. It learns them by fitting the ratings that do exist, with regularization to stop it from memorizing. Afterwards, the factors often line up with recognizable genres.

The math

With user vectors pup_u, item vectors qiq_i and biases, minimize over the observed ratings only:

∑(u,i) observed(rui−μ−bu−bi−pu⊤qi)2+λ(∥pu∥2+∥qi∥2+bu2+bi2)\sum_{(u,i) \text{ observed}} \left( r_{ui} - \mu - b_u - b_i - p_u^\top q_i \right)^2 + \lambda \left( \lVert p_u \rVert^2 + \lVert q_i \rVert^2 + b_u^2 + b_i^2 \right)

Solve with stochastic gradient descent or alternating least squares (fix PP, solve for QQ exactly, swap).

The approach became famous during the Netflix Prize, which shaped streaming recommendations. Modern systems replace the dot product with deep networks and add many more signals, but the core idea of user and item embeddings remains.

Everyday use cases

  • Case 01

    "Because you watched..."

    Predicting how much you would enjoy a film you haven't seen from the hidden tastes you share with other viewers.

  • Case 02

    Music and shopping suggestions

    The same trick on plays or purchases instead of star ratings.

Famous examples

Strengths, weaknesses and when to use it

Strengths

  • Scales to millions of users and items; predictions are a single dot product.
  • Learned factors often match real tastes (genres, moods) without being told.

Weaknesses

  • Cold start: a brand new user or item has no factors yet.
  • Uses only the interaction table, ignoring content and context unless extended.

When to use itAs a strong, simple baseline for collaborative filtering on user-item interaction data.

Compare with

Check yourself

  1. Q01

    What does each user and item get in matrix factorization?

    Show answer

    B: A short vector of hidden factors (an embedding)

  2. Q02

    How is a rating predicted?

    Show answer

    A: The dot product of the user's and the item's factor vectors

Go deeper