Session Ready
Exercise

Comparing linear_kernel and cosine_similarity

In this exercise, you have been given tfidf_matrix which contains the tf-idf vectors of a thousand documents. Your task is to generate the cosine similarity matrix for these vectors first using cosine_similarity and then, using linear_kernel.

We will then compare the computation times for both functions.

Instructions 1/2
undefined XP
  • 1

    Compute the cosine similarity matrix for tfidf_matrix using cosine_similarity.

    • 2

      Compute the cosine similarity matrix for tfidf_matrix using linear_kernel.