A. emb1 and emb2 should be 2D arrays, not 1D lists
B. cosine_similarity function does not exist in sklearn
C. embeddings must be strings, not numbers
D. print statement syntax is incorrect
Solution
Step 1: Check input format for cosine_similarity
cosine_similarity expects 2D arrays (like [[...]]), but emb1 and emb2 are 1D lists.
Step 2: Confirm other options
cosine_similarity exists, embeddings are numeric vectors, and print syntax is correct in Python 3.
Final Answer:
emb1 and emb2 should be 2D arrays, not 1D lists -> Option A
Quick Check:
Input shape must be 2D arrays [OK]
Hint: cosine_similarity needs 2D arrays, not 1D lists [OK]
Common Mistakes:
Passing 1D lists instead of 2D arrays
Thinking embeddings must be text
Misunderstanding print syntax
5. You have two sentences: "I love apples" and "I adore oranges". Using a pre-trained embedding model, you get vectors for both. Which approach best helps you find if these sentences have similar meaning?
hard
A. Calculate cosine similarity between their embeddings
B. Count common words between the sentences
C. Check if sentence lengths are equal
D. Compare the first letters of each word
Solution
Step 1: Understand semantic similarity goal
We want to compare meanings, not just words or sentence length.