Building the Recommendation Engine
Explore how to build a recommendation engine by applying correlation between rated and unrated movies. Learn to calculate anticipated scores from user ratings using Python dictionaries and loops. This lesson guides you through coding and interpreting results to recommend movies based on user preferences.
We'll cover the following...
Using correlation to rate movies
Say we have movie A and movie B. We’ve given a rating of 4.0 to movie A and the correlation between A and B is 1.0. Since 1.0 is the highest value, the movies are perfectly correlated, and the person who likes A should also like the B.
So our estimated score for B would be:
What if the correlation between movie A and movie B was -0.5? Our anticipated rating would be -2.0, which is very low. This means that those who enjoyed movie A probably wouldn’t like movie B.
To refresh, the steps are:
-
Look at the scores of the movies we’ve rated.
-
Check the rate movie’s correlation to the movies we haven’t rated.
-
Find our anticipated score.
-
Repeat steps 1–3 for all the three movies that we’ve rated.
Before we start on that, we’ve cleaned up corr_dict.py for users.
Let’s start with 27 dresses and try to calculate its anticipated score:
| My Movie [A] | My rating for movie [B] | Correlation of [B] with 27 dresses [C] | My calculated score [B] * [C] |
|---|