One question regarding to the triangle inequality of normalized Levenshtein Distance. I use the well-known form D(X,Y) = 1 - d(X,Y) / MAX(|X|,|Y|) where d(X,Y) is Levenshtein Distance.

And I understand it violates the triangle inequality. But I would like to ask: Can I still use it as a distance metric and under which circumstances should I really care about the triangle inequality?

Plus, I also note the cosine distance also violates the triangle inequality (Proving that cosine distance function defined by cosine similarity between two unit vectors does not satisfy triangle inequality), but why it's also widely used as distance function?

Thank you!

  • $\begingroup$ In comments to that reference I noted that the square root of the cosine "distance" essentially is a distance function (at least locally). Frequently, algorithms based on distances can quickly compute squared distances but do not actually need to compute the distances themselves. $\endgroup$
    – whuber
    Commented Jan 21, 2020 at 0:41


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.