Bird
0
0

Given two sentence embeddings `emb1 = [0.5, 0.5]` and `emb2 = [0.5, -0.5]`, what is their cosine similarity?

medium📝 Predict Output Q5 of 15
NLP - Text Similarity and Search
Given two sentence embeddings `emb1 = [0.5, 0.5]` and `emb2 = [0.5, -0.5]`, what is their cosine similarity?
A1.0
B0.5
C-1.0
D0.0
Step-by-Step Solution
Solution:
  1. Step 1: Calculate dot product of emb1 and emb2

    Dot product = 0.5*0.5 + 0.5*(-0.5) = 0.25 - 0.25 = 0
  2. Step 2: Calculate magnitudes and cosine similarity

    Magnitudes are both sqrt(0.5^2 + 0.5^2) = sqrt(0.5) ≈ 0.707; cosine similarity = 0 / (0.707*0.707) = 0
  3. Final Answer:

    0.0 -> Option D
  4. Quick Check:

    Dot product zero means cosine similarity zero [OK]
Quick Trick: Zero dot product means zero cosine similarity [OK]
Common Mistakes:
MISTAKES
  • Ignoring negative component in dot product
  • Confusing cosine similarity with Euclidean distance
  • Assuming similarity is always positive

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NLP Quizzes