Exercise

Normalize your data

Before you can find the factors of the ratings matrix using singular value decomposition, you will need to "de-mean", or center it, by subtracting each row's mean from each value in that row.

In this exercise, you will begin prepping the movie rating DataFrame you have been working with in order to be able to perform Singular value decomposition.

user_ratings_df contains a row per user and a column for each movie and has been loaded for you.

Instructions

100 XP
  • Find the average rating each user has given across all the movies they have seen and store these values as avg_ratings.
  • Subtract the row averages from their respective rows and store the result as user_ratings_centered.
  • Finally, fill in all missing values in user_ratings_centered with zeros.
  • Print the average of each column in user_ratings_centered to show they have been de-meaned.