Making recommendations based on movie genres
Now that you have your data in a usable format and know how to compare two movies, the next step is to use this to generate recommendations. In this exercise, you will learn how to generate recommendations for any movie in your dataset.
The similarity scores between all movies in the dataset that you calculated in the last exercise have been pre-loaded for you as jaccard_similarity_array
. movie_cross_table
containing the movies and their attributes is also available.
For ease of use, you will need to wrap the similarity scores in a DataFrame. Then you will use this new DataFrame to suggest a movie recommendation.
This exercise is part of the course
Building Recommendation Engines in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Wrap the preloaded array in a DataFrame
jaccard_similarity_df = ____.____(____, index=____.____, columns=____.____)
# Find the values for the movie Thor
jaccard_similarity_series = ____.____['Thor']
# Sort these values from highest to lowest
ordered_similarities = jaccard_similarity_series.sort_values(____)
# Print the results
print(ordered_similarities)