Here is the thing that still feels a little magical to me about recommender systems: a good one can suggest a film in a genre you have never touched, and be right, without knowing a single thing about what the film is actually about. No plot summary, no cast list, no tags. It works purely from the pattern of who rated what. That is collaborative filtering, and once it clicks it is surprisingly simple.
The starting point is a big table. Rows are users, columns are items, and each cell holds a rating, say 1 to 5 stars. The catch is that almost every cell is empty. Nobody rates more than a tiny sliver of a catalogue, so a real matrix is 95 to 99 percent blank. The entire job is to guess the blanks well, then show each user the handful of items with the highest predicted ratings. That is it. Everything else is just how you fill in the holes.
Find people like you
The oldest approach is user-user filtering. To recommend for you, find the users whose past ratings look most like yours, then borrow what they liked and you have not seen yet. "Look like yours" needs a number, and the number is cosine similarity computed over the items you both rated.
There is one detail that matters more than it looks. Before comparing two users, subtract each one's own average rating. Some people are generous and hand out fours and fives; some are harsh and cap out at three. If you do not center them, the generous rater looks like they love everything and the harsh one looks like they hate everything, even when they actually agree on which films are better than which. Mean-centered cosine on the shared items is exactly the Pearson correlation, and it runs from +1 for taste twins, through 0, down to -1 for people with opposite taste. That negative end is useful: someone who reliably disagrees with you is just as informative as someone who agrees.






