To teach students about collaborative and content filtering.
In this assignment, you’ll be using a technique called collaborative filtering to recommend movies to users, similar to how Netflix makes movie recommendations.
A recommender system is a program that recommends products—ranging from movies to books to clothing to news articles to search queries—to users. Prominent examples of companies that use recommender systems are Spotify, to find your songs like the songs you often listen to, and Amazon, to find your books (and many other products!) that you might like.
Netflix is famous for the efforts they spent developing and refining their recommender system. From 2006 to 2009, Netflix “crowdsourced” an algorithm to boost their sales and improve customer satisfaction. What this means is that they invited anyone (without any connection to Netflix) to submit code that would predict user ratings for movies, and they offered a large monetary prize
($1 million!), to any team that could best Netflix’s own algorithm by more than 10%. It was a high bar, but BellKor’s Pragmatic Chaos team succeeded.
Most recommendation systems follow one of two models: either collaborative filtering or content filtering. Collaborative ftltering collects a large amount of user data—behavior, preferences, etc.—and analyzes it, predicting what users will like based on the behavior of other similar users. Content ftltering, on the other hand, assigns keywords or descriptive tags to items, and then recommends items to users based on item similarity.
Netflix is actually a hybrid recommender system: it uses both collaborative filtering and content filtering. It can first use collaborative filtering to determine that Anna and Erin have similar taste in movies. Then, through content filtering, it can discover that “Toy Story,” which both of them liked, is categorized under the same set of genres as “Inside Out,” which neither of them has seen. If it then goes on to recommend “Inside Out” to both of them and they both love it, everyone wins.
The “ratings.csv” file found here contains users’ ratings of movies.
Your goal in this problem is to create a similarity matrix between movies, based not on their content (e.g., genres) as in Part 1, but instead based on their user ratings.
To do so, load “ratings.csv” into an R data frame, say ratings. This file is very large, so we recommend truncating your ratings data frame. You set a hard limit using ratings <- head(ratings, n) for some value of n as large as your computer can accommodate (e.g., 4000). Or, you can set a limit based on “userId”: e.g., ratings <- ratings > filter(userId < 20). In either case, the larger your data frame, the better your recommendations will be, but the slower your code will run.
From the truncated ratings data frame, create a matrix with users as rows, and movies as columns. Call it mat. The entries in this matrix should be mostly 0s, since most users have not seen most movies. But if the user has rated a movie, the entry in the matrix corresponding to a user (row) and movie (column) should be the user’s rating of that movie.
After creating this ratings matrix, you can then use the cosine function in the lsa package to create a similarity matrix based on cosine similarity as follows: cosine(mat). Note that the cosine function calculates similarities among columns in a matrix, not rows.
The similarity matrix is not that informative without the movie titles, so set the row and column names to be the movie titles. Hint: Use the match function to
find the indices of ratings$movieId in movies$movieId.
Use the View command to view the similarity matrix. Clicking on a column sorts the data by that column, and clicking twice sorts the data by that column in descending order. Click on three columns of your choice, and for each, report the five movies that are most similarly rated by users. Do you agree with these recommendations?
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of