Recommendation Systems
Because you liked this.
Most of what people watch on the big streaming services comes from recommendations, not from searching. These systems earn billions. And at heart, the idea is one that you already know. People who liked what you liked may like other things you have not tried yet.

- Most viewing comes from recommendations
- Worth billions
- The idea is simple
Two main approaches
There are two classic approaches. Content based filtering looks at the items themselves. You liked a science fiction film, so here is another. Collaborative filtering ignores the content completely, and only looks at behaviour. People who liked Alien also liked Blade Runner. It can find surprising connections, but it struggles with brand new items, which have no history. That is called the cold start problem. Modern systems mix both.
A tiny film recommender
Here is a tiny ratings table, with five people and five films. We turn each film into a list of who rated it, and how. Cosine similarity measures the angle between two of those lists. If the same people like both films, the angle is small. We look up Alien, and sort by similarity. Run it. It recommends Blade Runner first. We gave it no genres and no descriptions, and it found the link from behaviour alone. Real systems use the same idea, on billions of ratings.
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
films = ["Alien", "Blade Runner", "Toy Story", "Frozen", "Up"]
ratings = np.array([[5, 5, 1, 1, 2],
[4, 5, 0, 1, 1],
[1, 0, 5, 4, 5],
[0, 1, 4, 5, 4],
[5, 4, 1, 0, 0]], dtype=float)
sim = cosine_similarity(ratings.T)
target = films.index("Alien")
order = np.argsort(-sim[target])
for i in order[1:4]:
print(f"Because you liked Alien: {films[i]:<13} {sim[target, i]:.3f}")Because you liked Alien: Blade Runner 0.970 Because you liked Alien: Up 0.342 Because you liked Alien: Toy Story 0.279
Summary
Whether it is finding groups, spotting oddities, or recommending films, unsupervised ideas are everywhere. That is the end of this module, and you have now covered the core algorithms of machine learning. Next, a new skill. How do you squeeze the last bit of performance out of a model, without fooling yourself?
Key takeaways- Content: similar items
- Collaborative: similar people
- Cosine measures similarity