Bird
0
0

Which Python library is commonly used to compute cosine similarity between embeddings?

easy📝 Syntax Q12 of 15
NLP - Text Similarity and Search
Which Python library is commonly used to compute cosine similarity between embeddings?
Amatplotlib
Bscikit-learn
Cpandas
Dflask
Step-by-Step Solution
Solution:
  1. Step 1: Identify cosine similarity function

    Cosine similarity is often computed using scikit-learn's metrics module.
  2. Step 2: Check other libraries

    matplotlib is for plotting, pandas for data frames, flask for web apps, so they don't compute cosine similarity.
  3. Final Answer:

    scikit-learn -> Option B
  4. Quick Check:

    Cosine similarity = scikit-learn [OK]
Quick Trick: Use scikit-learn for cosine similarity calculations [OK]
Common Mistakes:
MISTAKES
  • Using matplotlib for similarity
  • Confusing pandas with similarity tools
  • Thinking flask handles embeddings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NLP Quizzes