this is my lab Id: zpwxnkgmsulr

Question: idx = nearest_neighbor(tweet_embedding, document_vecs, 1)

idx2 = np.argmax(cosine_similarity(document_vecs, tweet_embedding))

idx, idx2

(array([3333]), 5202)

why is the result different?

this is my lab Id: zpwxnkgmsulr

Question: idx = nearest_neighbor(tweet_embedding, document_vecs, 1)

idx2 = np.argmax(cosine_similarity(document_vecs, tweet_embedding))

idx, idx2

(array([3333]), 5202)

why is the result different?

`nearest_neighbor()`

is calling `cosine_similarity()`

one row of `document_vecs`

at time. Versus calling `cosine_similarity()`

on the entire `document_vecs`

matrix at once. I didnâ€™t work through the math by hand, but my intuition is that the `linalg(norm())`

is going to be different.