To estimate a rating for an item a user hasn't seen, particularly within recommendation systems using neighborhood-based collaborative filtering, one approach involves leveraging the behavior of similar users or items, commonly known as 'neighbors'. The goal is to predict how a user would rate an item they haven't seen before. This prediction is made by calculating a weighted average of the ratings from these neighbors. The core idea is simple: the opinions of more similar neighbors should have more influence on the prediction.
Let's examine how this works for both user-based and item-based approaches.
In a user-based approach, we predict a user's rating for an item based on the ratings given to that same item by similar users. However, a simple average is often misleading because different users have different rating scales. One user might rate movies from 3 to 5 stars, while another uses the full 1-to-5 range.
To account for this, we use the deviation from each user's average rating. The prediction formula for user 's rating on item is:
Let's break down this formula:
Imagine we want to predict how You will rate the movie Blade Runner 2049. Your average rating for all movies is 3.5. We find three similar users (your neighbors) who have also rated this movie.
| User | Similarity to You | Rating for Blade Runner 2049 | User's Average Rating |
|---|---|---|---|
| Alex | 0.9 | 5.0 | 4.0 |
| Ben | 0.8 | 4.0 | 3.2 |
| Chris | 0.5 | 3.0 | 3.8 |
First, we calculate the weighted sum of the neighbors' adjusted ratings:
The numerator is the sum of these values: . The denominator is the sum of the absolute similarity scores: .
Now, we plug these into the formula:
Our model predicts you would rate Blade Runner 2049 approximately 4.02. This prediction is influenced more by Alex, your most similar neighbor, who loved the movie.
The prediction process for a user-based recommender. The opinions of more similar neighbors (like Alex) contribute more to the final predicted rating.
For an item-based approach, the logic is parallel but simpler. To predict user 's rating for item , we look at other items that user has already rated. We then take a weighted average of those ratings, where the weights are the similarities between item and the other items.
The formula is:
Here's the breakdown:
Notice that we don't need to adjust for user averages here. The entire calculation is based on the ratings from a single user (), so the rating scale is inherently consistent.
Let's stick with predicting your rating for Blade Runner 2049. This time, we use an item-based approach. We find three movies similar to Blade Runner 2049 that you have already rated.
| Similar Movie (Item j) | Similarity to Blade Runner 2049 | Your Rating for This Movie |
|---|---|---|
| Dune | 0.95 | 5.0 |
| Arrival | 0.88 | 4.0 |
| The Matrix | 0.70 | 4.0 |
The weighted sum of your ratings (the numerator) is:
The sum of the similarity weights (the denominator) is:
The predicted rating is:
The item-based model predicts you would rate the movie 4.37, based on your positive ratings of similar sci-fi films.
By applying these weighted average formulas, we can transform similarity scores into concrete, personalized rating predictions. These predictions form the basis for our recommendation lists, allowing us to rank unseen items and suggest the ones a user is most likely to enjoy.
Was this section helpful?
© 2026 ApX Machine LearningEngineered with