What is the difference between wmd (word mover distance) and wmd based similarity?

Viewed 2016

I am using WMD to calculate the similarity scale between sentences. For example:

distance = model.wmdistance(sentence_obama, sentence_president)

Reference: https://markroxor.github.io/gensim/static/notebooks/WMD_tutorial.html

However, there is also WMD based similarity method (WmdSimilarity).

Reference: https://markroxor.github.io/gensim/static/notebooks/WMD_tutorial.html

What is the difference between the two except the obvious that one is distance and another similarity?

Update: Both are exactly the same except with their different representation.

n_queries = len(query)
result = []
for qidx in range(n_queries):
    # Compute similarity for each query.
    qresult = [self.w2v_model.wmdistance(document, query[qidx]) for document in self.corpus]
    qresult = numpy.array(qresult)
    qresult = 1./(1.+qresult)  # Similarity is the negative of the distance.

    # Append single query result to list of all results.
    result.append(qresult)

https://github.com/RaRe-Technologies/gensim/blob/develop/gensim/similarities/docsim.py

1 Answers
Related