Aan de slagGa gratis aan de slag

Improved non-personalized recommendations

Just because a movie has been watched by a lot of people doesn't necessarily mean viewers enjoyed it. To understand how a viewer actually felt about a movie, more explicit data is useful. Thankfully, you also have ratings from each of the viewers in the Movie Lens dataset.

In this exercise, you will find the average rating of each movie in the dataset, and then find the movie with the highest average rating.

You will use the same user_ratings_df as you used in the previous exercise, which has been loaded for you.

Deze oefening maakt deel uit van de cursus

Building Recommendation Engines in Python

Cursus bekijken

Oefeninstructies

  • Find the average rating for each of the movies and store it as a DataFrame called average_rating_df.
  • Sort the average_rating_df DataFrame by the average rating column from highest to lowest and store it as sorted_average_ratings.
  • Print the entries for the top five highest ranked movies in sorted_average_ratings.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Find the mean of the ratings given to each title
average_rating_df = user_ratings_df[["title", "rating"]].____('title').____()

# Order the entries by highest average rating to lowest
sorted_average_ratings = average_rating_df.____(____=____, ____=____)

# Inspect the top movies
print(____.____())
Code bewerken en uitvoeren