-1
$\begingroup$

I have two n-dimensional vectors, where their values v1,..vn are between 0-1.

Lets say: vector1 = [0.91,0.48,0.1] , vector2 = [0.73,0.56,0.015]

I want to determine how similar they are, direction-wise. Tried to use cosine distance and I fell like the values I get are not right. For example, for these two vectors above I get: 0.017 Is it wrong? I really need a way to say how similar are these vectors.

Thanks.

1 Answers 1

1

I would definitely disagree with the value you gave there; those vectors "seem" pretty similar.

Recall that the cosine similarity between vectors $\vec{v}$ and $\vec{w}$ is $$ \cos\theta=\frac{\vec{v}\cdot\vec{w}}{\|\vec{v}\|\cdot\|\vec{w}\|}. $$ We can compute this directly: $$ \begin{align*} \frac{\vec{v}_1\cdot\vec{v}_2}{\|\vec{v}_1\|\cdot\|\vec{v}_2\|}&=\frac{0.91\cdot0.73+0.48\cdot0.56+0.1\cdot0.015}{\sqrt{0.91^2+0.48^2+0.1^2}\cdot\sqrt{0.73^2+0.56^2+0.015^2}}\\ &\approx\frac{0.9346}{1.0337\cdot0.9202}\\ &\approx0.9825 \end{align*} $$ These are very similar!

  • 0
    Thanks! It just seems a bit far...2017-02-23
  • 0
    A bit far? Higher similarity means vectors are more similar.2017-02-23