holehouse.org Blog Machine learning notes

16: Recommender Systems

Recommender systems - introduction

Example - predict movie ratings

Content based recommendation

The same ratings, with two features per film: how much romance and how much action it contains.
MovieAlice (1)Bob (2)Carol (3)Dave (4)x1(romance)x2(action)
Love at last55000.90
Romance forever5??01.00.01
Cute puppies of love?40?0.990
Nonstop car chases00540.11.0
Swords vs. karate005000.9

How do we learn (θj)

Collaborative filtering - overview

Formalizing the collaborative filtering problem

How does this work with the previous recommendation system

Collaborative filtering Algorithm

Minimisingx(1),…,x(nm)andθ(1),…,θ(nu)simultaneously: J(x(1),…,x(nm),θ(1),…,θ(nu))=12∑(i,j):r(i,j)=1((θ(j))Tx(i)−y(i,j))2+λ2∑i=1nm∑k=1n(xk(i))2+λ2∑j=1nu∑k=1n(θk(j))2 minx(1),…,x(nm),θ(1),…,θ(nu)J(x(1),…,x(nm),θ(1),…,θ(nu)) Solving for both at once. The single sum over (i, j) with r(i, j) = 1 replaces the nested sums above — it runs over every rating that exists, once each.

Algorithm Structure

Vectorization: Low rank matrix factorization

Recommending new movies to a user

Implementation detail: Mean Normalization

minx(1),…,x(nm),θ(1),…,θ(nu)12∑(i,j):r(i,j)=1((θ(j))Tx(i)−y(i,j))2+λ2∑i=1nm∑k=1n(xk(i))2+λ2∑j=1nu∑k=1n(θk(j))2 for Eve, this reduces toλ2[(θ1(5))2+(θ2(5))2] Eve has rated nothing, so no term of the first sum involves her and the middle term does not involve θ at all. Only the regularisation on her own parameters is left — and that is minimised by setting them to zero, which predicts zero for every film.

How does mean normalization work?