July 2018
Beginner to intermediate
146 pages
3h 39m
English
The next step is to calculate the pairwise cosine similarity score of every movie. In other words, we are going to create a 45,466 × 45,466 matrix, where the cell in the ith row and jth column represents the similarity score between movies i and j. We can easily see that this matrix is symmetric in nature and every element in the diagonal is 1, since it is the similarity score of the movie with itself.
Like TF-IDFVectorizer, scikit-learn also has functionality for computing the aforementioned similarity matrix. Calculating the cosine similarity is, however, a computationally expensive process. Fortunately, since our movie plots are represented as TF-IDF vectors, their magnitude is always 1. Hence, we ...
Read now
Unlock full access