CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Building Recommendation Engines in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de 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)
Modifier et exécuter le code