Kolton Ndoj

Recommenders: you are an arrow, and so is every movie

When Netflix, YouTube or Spotify suggests 'because you watched…'

What problem does it solve?

How can a computer tell which people (or songs) have similar taste?

The big idea

Turn each person into an arrow: one direction per movie, and the length along it is how much they liked it. People with similar taste point in similar directions, even if one rates everything high and the other rates everything low. The angle between arrows measures taste, and its cosine comes straight from the dot product. Modern systems go further and learn short 'taste vectors' (maybe 'how much action, how much romance…') for every user and item, so a predicted rating is just a dot product.

How it works, step by step

  1. 1. Write each person's ratings as a list of numbers, a vector.
  2. 2. Compute the dot product: multiply matching ratings and add them up.
  3. 3. Divide by the lengths of both vectors to get cos θ, between −1 and 1.
  4. 4. Find your most similar neighbours and recommend what they loved that you haven't seen.

The key formula

cos⁡θ=a⋅b∥a∥ ∥b∥=∑iaibi∑iai2∑ibi2\cos\theta=\frac{\mathbf a\cdot\mathbf b}{\lVert\mathbf a\rVert\,\lVert\mathbf b\rVert}=\frac{\sum_i a_ib_i}{\sqrt{\sum_i a_i^2}\sqrt{\sum_i b_i^2}}
a⋅b\mathbf a\cdot\mathbf b
the dot product: big when both vectors are large in the same places
∥a∥\lVert\mathbf a\rVert
the length of the arrow (Pythagoras in many dimensions)
cos⁡θ\cos\theta
1 = identical taste direction, 0 = unrelated, −1 = opposite

How fast is it?

Comparing two users is cheap, but comparing everyone to everyone is not (millions × millions). Real services learn compact taste vectors and use fast 'approximate nearest neighbour' searches, and they mix in many other signals, such as what you watched recently and what you clicked but abandoned.

Try it yourself

Fun fact

From 2006 to 2009 Netflix offered $1,000,000 to anyone who could beat its recommender by 10%. The team 'BellKor's Pragmatic Chaos' won with a 10.06% improvement, but Netflix said in 2012 that it never fully deployed the winning blend because the extra accuracy didn't justify the engineering effort.

Related

Open it in the Math Lab →

AI · Intermediate