The following code when run gives the cosine distance between two words.
model.wv.distance('word1','word2')
How do I find the euclidean distance between two words? I am using gensim for word2vec implementation
The following code when run gives the cosine distance between two words.
model.wv.distance('word1','word2')
How do I find the euclidean distance between two words? I am using gensim for word2vec implementation
Usually the cosine-distance is preferred in this domain.
But if you needed euclidean distance, you can just request the raw vectors for each word, find the difference, and use a basic `numpy.linalg.norm' operation, as per this StackOverflow answer:
How can the Euclidean distance be calculated with NumPy?
Specifically:
import numpy as np
euc_dist = np.linalg.norm(model.wv['word1'] - model.wv['word2']))