Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CMPE 150 Fall 2021 Project 2: Movie Recommender In this project you will implement a movie recommendation system. The system will make recommendations for a

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

CMPE 150 Fall 2021 Project 2: Movie Recommender In this project you will implement a movie recommendation system. The system will make recommendations for a user based on ratings of other users. You are given a file named ratings.csv containing movie rating history for a set of users. Each line of this file corresponds to the history of a user and includes user id and information of movies rated by this user separated by commas (). For each movie, its name and rating are given and this pair is separated by a column (). For instance, the line UserX, Toy Story:5, Up:5, Inside Out: 4 indicates that this user has id Userx and watched three movies: Toy Story . Up. Inside Out and gave ratings of 5 5 4 respectively. To make recommendations, the system will consider the similarity of user movie ratings and suggest movies from history of users with most "similar" tastes. The taste similarity of users will be computed as 1 over the sum of absolute difference between ratings of these users. If a movie has been rated by one user but not the other one, then the mean rating of the movie is considered as the rating of the user that has not rated yet Sample Dataset Consider the sample dataset containing only four users with the following rating histories: User A, Toy Story:5, Up:5, Inside Out:4 UserB, Toy Story:2, Wall-E:5 Userc, Toy Story:5,Inside Out:5, Zootopia: 4 UserD, Zootopia: 1 Mean Rating Mean rating of a movie is calculated as the sum of ratings divided by the number of users that rated the particular movie. Then, the mean ratings of movies in the sample set will be as follows: Mean Rating Movie 4.0 Toy Story 5.0 Up 4.5 Inside Out 5.0 Wall-E User Similarity The taste similarity of users is calculated as 1 over the sum of absolute difference between ratings of these users. The similarities of users in the sample set are given below: Pair Similarity UserA-UserB 1/3.5 UserA-User 1/2.5 UserA-UserD 1/3.0 UserB-User 1/5.0 UserB-UserD 1/3.5 UserC-UserD 1/4.5 Explanation for UserA-UserB: The movies rated by either UserA or UserB: Toy Story, Up, Inside Out, Wall-E. The rating differences for these movies are Toy Story: 5 - 2 = 3 Up: 5-5 (mean rating) = 0 Inside Out: 4 - 4.5 (mean rating) = -0.5 Wall-E: 5 (mean rating) - 5 = 0 The sum of absolute values are 3.5. So, the similarity is 1/3.5. Recommendations The recommender will take a user id and the number of similar users (N) as inputs, and then, find N most similar users to given user and suggests movies that such users have rated highly (i.e. the rating is greater than or equal to 3) but not yet being rated by the given user. If a movie has been rated by more than one most similar user, then the rating by each user must be greater than or equal to 3 for this movie to be recommended. For the input UserD, 2 in the sample set, the recommender system will suggest Inside Out. Up and Wall-E since the most similar users are UserA and Users, and the ratings of these modes are creater thank Note that was not succosted since its tatin bonis 2 Recommendations The recommender will take a user id and the number of similar users (N) as inputs, and then, find N most similar users to given user and suggests movies that such users have rated highly (i.e. the rating is greater than or equal to 3) but not yet being rated by the given user. If a movie has been rated by more than one most similar user, then the rating by each user must be greater than or equal to 3 for this movie to be recommended. For the input UserD, 2 in the sample set, the recommender system will suggest Inside Out , Up and Wall-E since the most similar users are Usera and Users, and the ratings of these movies are greater than 3. Note that Toy Story is not suggested since its rating by Users is 2. You are given the main program which takes a user_id and the number of similar users N, and calls a set of functions to make recommendations. You are supposed to complete these functions. You are allowed and encouraged to write and use additional functions. However, YOU ARE NOT ALLOWED TO CHANGE THE MAIN PROGRAM. Please note that importing libraries is not allowed. To compute absolute value, you can use the given function abs(). Examples Input Output User 10.1 Taxi Driver, Total Recall User50,1 Mamma Mia! The Mask of Zorro The Prestige User200,2 The Untouchables User450,3 Con Air, The Mask of Zorro The most similar users for the inputs above are given in the below table: Input User Most Similar Users User 10 User412 User50 User286 User 200 User895, User461 User450 User232, User 169, User960 Mean ratings for a set of movies can be found below: Mean Rating Movie 3.075 Total Recall 3.026315789473684 The Mask of Zorro 2.782608695652174 Con Air 2.826923076923077 The Prestige 2.8333333333333335 Message in a Bottle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions