Cosine Similarity: Explained and Examples

  • Thread starter Thread starter daveronan
  • Start date Start date
  • Tags Tags
    Cosine
daveronan
Messages
13
Reaction score
0
Just for clarification...

If I take the cosine similarity of two vectors and i get an answer of 1, then bother vectors are equal and the same.

If I do the same again with another two vectors and get an answer of 0, then the vectors are at an angle of 90 degrees to each other and dissimilar.

If I do the same again with another two vectors and get an answer of -1, then the vectors are at an angle of 180 degrees to each other and are even more dissimilar than they were at 90 degree or should I always take the absolute value of the answer. The equation I'm referring to can be found here.

http://upload.wikimedia.org/math/f/3/6/f369863aa2814d6e283f859986a1574d.png

Thanks!
 
Physics news on Phys.org
If the cosine of two vectors is 1 then they are scalar multiples of each other. If it is -1 then it is same except the scalar is negative. If the cosine is 0 they are orthogonal. Don't take the absolute value. The greater the number the greater the similarity.

As far as similarity goes, I'm guessing you are looking at the vector space model for text search since they represents documents as term weight vectors and similarity between documents is taken as the cosine between their corresponding vectors. This similarity is a separate notion that leverages the cosine and is not inherent in the cosine of two vectors. With that said, term weight vectors consist of non-negative weights and so all vectors will be within 90 degrees or less with each other and negative similarity is not possible so you only consider 0 to 1.
 
Hi TheOldHag,

First of, thanks for getting back to me.

I'm comparing audio features (MFCCs), so it's possible for me to get vectors with negative values.

Thanks for your answer. You can't beat clarification! :)
 
Vectors that are scalar multiples of each other are in the same one dimensional subspace of each other. I think similarity is domain specific so not sure how to answer the question. They are similar because they are scalar multiples and they are different because they are oppositely signed.

FYI, I'm answering questions because I'm in the process of learning myself but there are limits to what I know.
 
Thread 'Determine whether ##125## is a unit in ##\mathbb{Z_471}##'
This is the question, I understand the concept, in ##\mathbb{Z_n}## an element is a is a unit if and only if gcd( a,n) =1. My understanding of backwards substitution, ... i have using Euclidean algorithm, ##471 = 3⋅121 + 108## ##121 = 1⋅108 + 13## ##108 =8⋅13+4## ##13=3⋅4+1## ##4=4⋅1+0## using back-substitution, ##1=13-3⋅4## ##=(121-1⋅108)-3(108-8⋅13)## ... ##= 121-(471-3⋅121)-3⋅471+9⋅121+24⋅121-24(471-3⋅121## ##=121-471+3⋅121-3⋅471+9⋅121+24⋅121-24⋅471+72⋅121##...
##\textbf{Exercise 10}:## I came across the following solution online: Questions: 1. When the author states in "that ring (not sure if he is referring to ##R## or ##R/\mathfrak{p}##, but I am guessing the later) ##x_n x_{n+1}=0## for all odd $n$ and ##x_{n+1}## is invertible, so that ##x_n=0##" 2. How does ##x_nx_{n+1}=0## implies that ##x_{n+1}## is invertible and ##x_n=0##. I mean if the quotient ring ##R/\mathfrak{p}## is an integral domain, and ##x_{n+1}## is invertible then...
The following are taken from the two sources, 1) from this online page and the book An Introduction to Module Theory by: Ibrahim Assem, Flavio U. Coelho. In the Abelian Categories chapter in the module theory text on page 157, right after presenting IV.2.21 Definition, the authors states "Image and coimage may or may not exist, but if they do, then they are unique up to isomorphism (because so are kernels and cokernels). Also in the reference url page above, the authors present two...
Back
Top