1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. Feature Engineering for NLP in Python

Connected

अभ्यास

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.

निर्देश 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.