How to find similarity of two words in Glove? We have model.similarity(word1, word2)
in Word2vec. Is there a similar way in GloVe? How to save and load trained GloVe model?
Asked
Active
Viewed 1,281 times
0

halfer
- 19,824
- 17
- 99
- 186

Priyadharshini Ravi
- 9
- 1
- 1
- 8
2 Answers
2
You can also use scikit-learn
from sklearn.metrics.pairwise import cosine_similarity
cosine_similarity([[1, 0, -1]], [[-1,-1, 0]])
array([[-0.5]])

nag
- 749
- 4
- 9
1
You can use cosine similarity.
EDIT
You can use SciPy package. Python code for cosine similarity:
from scipy import spatial
word_1 = [3, 45, 7, 2]
word_2 = [2, 54, 13, 15]
result = 1 - spatial.distance.cosine(word_1, word_2)

Novak
- 2,143
- 1
- 12
- 22
-
Thanks.Can you please write the syntax? – Priyadharshini Ravi Jan 09 '19 at 11:10
-
Edited in the post :) – Novak Jan 09 '19 at 11:26