In Chapter 1, Getting Started with Recommender Systems, we learned what user-based collaborative filters do: they find users similar to a particular user and then recommend products that those users have liked to the first user.
In this section, we will implement this idea in code. We will build filters of increasing complexity and gauge their performance using the framework we constructed in the previous section.
To aid us in this process, let's first build a ratings matrix (described in Chapters 1, Getting Started with Recommender Systems and Chapter 5, Getting Started with Data Mining Techniques) where each row represents a user and each column represents a movie. Therefore, the value in the ith row and jth column will denote the rating given by user i to movie j. As usual, pandas gives us a very useful function, called pivot_table, to...