0
$\begingroup$

How to prove that the cosine distance ($1-\text{cosine similarity}$) does not satisfy the four properties (Non-Negativity, Coincidence Axiom, Symmetry, Triangle Inequality) of a metric over Euclidean space?

If some properties are satisfied then how can I show it is satisfied?

$\endgroup$

1 Answer 1

0
$\begingroup$

We have $$D(x,y) = 1- S(x,y)$$ where $$S_c(x,y) = \frac{x \cdot y}{||x|| \, ||y||}$$ First of all, $S(\cdot, \cdot)$ is not defined when either of its inputs is $0$, so $D$ cannot be a metric on $\mathbb{R}^n$. A better question to ask is whether or not $D$ is a metric on $\mathbb{R}^n \backslash \{0\}$. The answer is still no: $$D((1,1), (2,2)) = 1 - \frac{(1,1)\cdot(2,2)}{||(1,1)|| \, ||(2,2)||}$$ $$=1- \frac{4}{\sqrt{2} \cdot 2\sqrt{2}} = 0$$ actually, the coincidence axiom is violated for any pair of nonequal vectors which are positive scalar multiples of each other. Why? Think of the definition of cosine and angles between vectors in $\mathbb{R}^n$!

$\endgroup$
5
  • $\begingroup$ well, I have to show whether cosine distance is satisfied each of the properties of metrics or not. So in your explanation, which condition you proved? $\endgroup$ Nov 22, 2020 at 7:11
  • $\begingroup$ The cosine distance is symmetric and nonnegative. I show above that it does not satisfy the coincidence axiom, hence it is not a metric. I would give a detailed explanation as to why each of the above properties are or aren't true, but if you need to ask "what condition was proved" in the above explanation while asking for explicit solutions to this problem, I would wager that you are not mathematically mature enough to be studying this material (no offense intended), since it is a rather simple exercise in metric spaces. $\endgroup$ Nov 22, 2020 at 7:22
  • $\begingroup$ ok if I want to show that cosine distance is nonnegative and symmetric. How can I show with an example? $\endgroup$ Nov 22, 2020 at 7:25
  • $\begingroup$ You cannot prove symmetry and nonnegativity with "examples" -- you need to give proofs. These are very simple calculations -- I would go far as to say that symmetry is a trivial result. If you are having trouble with this, I do not think you are ready to study this kind of problem. $\endgroup$ Nov 22, 2020 at 7:33
  • $\begingroup$ ok. thanks for your help. let me try. $\endgroup$ Nov 22, 2020 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.