Session Ready
Exercise

Comparing individual movies with Jaccard similarity

In the last lesson, you built a DataFrame of movies, where each column represents a different genre. You can now use this DataFrame to compare movies by measuring the Jaccard similarity between rows. The higher the Jaccard similarity score, the more similar the two items are.

In this exercise, you will compare the movie GoldenEye with the movie Toy Story, and GoldenEye with SkyFall and compare the results.

The DataFrame movie_cross_table containing all the movies as rows and the genres as Boolean columns that you created in the last lesson has been loaded.

Instructions 1/3
undefined XP
  • 1
    • Import the Jaccard similarity score function from sklearn.metrics.
    • 2
      • Convert the rows containing 'GoldenEye' and 'Toy Story' to numpy arrays and measure their similarity.
    • 3
      • Convert the row containing Skyfall to a numpy array and measure its similarity to GoldenEye.