Notes

Adjusted Cosine Similarity

Two films can look almost identical when you compare the raw ratings they received and still have nothing in common, because some people hand out fives freely while others reserve them for masterpieces. Adjusted cosine similarity strips that distortion out before the comparison happens.

What the adjustment actually is
The measure compares two items across the users who rated both, but subtracts each user's own mean rating from every value first. The numerator sums the products of those mean-centred ratings, and the denominator normalises by their magnitudes, exactly as plain cosine does. Centring on the user mean rather than the item mean is the whole point: it turns "rated 4" into "rated a point above what this person usually gives", so agreement is measured in deviations from personal habit.

Where it sits in the pipeline
Similarities are computed offline into an item-item table. At request time the score for an unrated item is a similarity-weighted average over items the user has already rated, restricted to the k nearest items. Because the heavy work is precomputed, serving stays inside a few milliseconds even over a large catalogue.

Why it matters
On explicit-rating data such as MovieLens, uncentred cosine makes two items look alike simply because generous raters happened to rate both, and the resulting neighbourhoods fill up with widely-rated popular titles. The adjustment is what makes item-item neighbourhoods usable:

  • It cancels per-user scale and offset, the largest nuisance signal in ratings.
  • It keeps similarity comparable across items with very different rating volumes.
  • It has no implicit-feedback analogue, since clicks and plays carry no scale to centre, which is why binary cosine or conditional-probability similarity is used there instead.

Adjusted cosine similarity measures how alike two items are from the ratings given by users who rated both, after subtracting each user's mean rating from every value. Centring on the user removes differences in personal rating generosity, which plain cosine misreads as genuine agreement. It is the standard similarity for item-based collaborative filtering on explicit ratings: the precomputed item-item table it produces drives the similarity-weighted average that predicts an unrated item's score.

Imagine asking two friends to score the same ten films. One is generous and never goes below six. The other is harsh and rarely passes five. Compare their raw numbers and they look like they disagree about everything, even though they ranked the films in the same order.

Adjusted cosine similarity is the fix. Before checking whether two films appeal to the same people, it subtracts each person's own average score from everything they gave. What is left is whether someone liked a film more or less than they usually like things. Films that lift the same people above their own average count as similar, and that is how the next suggestion gets picked.