ComeçarComece de graça

Similar and different movie ratings

Some types of movies might be liked by one group of people, but hated by another. This might reflect the type of movie far more than its quality. Take, for example, horror movies — many people absolutely love them, while others hate them.

By understanding which movies were reviewed in a similar way, we can often find very similar movies.

In this exercise, you will compare movies and see whether they have received similar reviewing patterns.

The DataFrame movie_ratings_centered has been loaded with a row per movie, and the centered ratings it received as the values.

Este exercício faz parte do curso

Building Recommendation Engines in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

from sklearn.metrics.pairwise import cosine_similarity

# Assign the arrays to variables
sw_IV = movie_ratings_centered.loc['Star Wars: Episode IV - A New Hope (1977)', :].values.reshape(1, -1)
sw_V = ____.____['Star Wars: Episode V - The Empire Strikes Back (1980)', :].____.____(1, -1)

# Find the similarity between two Star Wars movies
similarity_A = cosine_similarity(____, ____)
print(similarity_A)
Editar e executar o código