Question: Predicting Movie Popularity python Suppose you are hosting a weekly movie night for your friends. Based on new releases, you would like to select the
Predicting Movie Popularity
python


Suppose you are hosting a weekly movie night for your friends. Based on new releases, you would like to select the best films to watch next week. You've guessed what kind of movie each of your n friends would like based on m typical movie attributes: amount of humor, action, scariness, etc. You predict that any given friend with preferences Po, . . . , Pm- [0, 10] will give a movie with attributes ao, . . . ,@m- . (normalized to sum to one) a rating r [0, 10], where m- Determine the rating each friend will give each movie. Then create a vector ratings where the ith element is the sum of all your friends' ratings for the ith movie. From this vector, determine the most likely preferred movie to watch next week and store the index of this top-rated movie in the variable top. Hint: Consider a single friend first. Think about how you could use a matvec to determine the ratings of each movie for a single friend. As a part of the input you will be given these functions: get_friend_prefs(i): Function that outputs a vector of length m with predicted movie attribute preferences po, ,Pm-1 of friendi get_movie_attr(j): Function that outputs a vector of length m with attributes ao,... , am-1 of movie The setup code gives the following variables Description number of friends number of movie attributes number of new movies see problem statement see problem statement Name integer integer integer function function get friend_prefs get_movie_attr Your code snippet should define the following variables: Name ratings1D numpy array top Description Vector of predicted ratings for each of the k movies Index of top-rated movie Type integer user_code.py Suppose you are hosting a weekly movie night for your friends. Based on new releases, you would like to select the best films to watch next week. You've guessed what kind of movie each of your n friends would like based on m typical movie attributes: amount of humor, action, scariness, etc. You predict that any given friend with preferences Po, . . . , Pm- [0, 10] will give a movie with attributes ao, . . . ,@m- . (normalized to sum to one) a rating r [0, 10], where m- Determine the rating each friend will give each movie. Then create a vector ratings where the ith element is the sum of all your friends' ratings for the ith movie. From this vector, determine the most likely preferred movie to watch next week and store the index of this top-rated movie in the variable top. Hint: Consider a single friend first. Think about how you could use a matvec to determine the ratings of each movie for a single friend. As a part of the input you will be given these functions: get_friend_prefs(i): Function that outputs a vector of length m with predicted movie attribute preferences po, ,Pm-1 of friendi get_movie_attr(j): Function that outputs a vector of length m with attributes ao,... , am-1 of movie The setup code gives the following variables Description number of friends number of movie attributes number of new movies see problem statement see problem statement Name integer integer integer function function get friend_prefs get_movie_attr Your code snippet should define the following variables: Name ratings1D numpy array top Description Vector of predicted ratings for each of the k movies Index of top-rated movie Type integer user_code.py
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
