2
$\begingroup$

I understand what cosine similarity is and how to calculate it, specifically in the context of text mining (i.e. comparing tf-idf document vectors to find similar documents). What I'm looking for is some better intuition for interpreting the results/similarity scores I come up with.

My question: If I have a cosine similarity of less than 0.707 (i.e. an angle greater than 45 degrees), is is fair to say that those respective documents/vectors are more "different" (less "similar") since the angle between them is more orthogonal? My initial thought was 'yes,' but in practice for me so far it doesn't seem like that's the right way to read into the numbers.

$\endgroup$
  • 4
    $\begingroup$ Cosine similarity is like Pearson correlation, only done on not centered data. For binary data, it is known also as Ochiai coefficient. Yes, cosine similarity bw two vectors is, like r, is the cosine of the angle between them. $\endgroup$ – ttnphns Jan 17 '17 at 20:59
  • $\begingroup$ You are asking specifically about using it in text mining. I'm not text analyst, I just suppose the compared documents are formed as binary data, yes? Then probably the meaning is the meaning of Ochiai? (see its formula). $\endgroup$ – ttnphns Jan 17 '17 at 21:04
0
$\begingroup$

I believe another difference between cosine similarity and TF-IDF is that cosine similarity is done in an embedding space, such as one created by doc2vec.

Such an embedding puts words that are used in similar contexts near to each other, so you could use clustering to find similar documents. But cosine distance probably makes more sense for a couple of reasons:

  1. An embedding like doc2vec encodes information in direction and distance. Look at the examples of king - man + woman yielding queen. I'd guess that direction dominates this comparison.

  2. In high-dimensional spaces, "nearby" (distance) can begin to lose its meaning, so directional measures -- which are also by definition finite and determined a priori -- might make more sense if the "inner product space" supports it. (I threw the last part in there not totally understanding what an "inner product space" is, but it sounds cool and it is related... I just couldn't explain how.)

So, given that, I'd say that the idea of "orthogonality" isn't meaningful here. Two documents are either together in a smaller wedge of the space or a larger wedge of the space and that's that: 100 degrees apart is farther apart than 90 degrees, and 80 degrees apart is closer.

| cite | improve this answer | |
$\endgroup$
-1
$\begingroup$

Cosine similarity is computed all the text documents after pre processing , like removals of stop words, stemming and applying Term frequency. Let us say A,B,C,D are four documents, I need to find out the similarity I can apply cosine similarity after going through all the preprocessing and calculating the weigths. Finally determine which are similarity based on the Angel, Now I would like to see the key tokens which contribution, (like man of the match in Cricket) and what semantic it is occurring weather is object or thing or Noun or Verb and predict the tokens which is relevant , For instance ,I live in Java and place is good. Here the context is JAVA ia Island , not bike nor oops. These way CS(cosine similarity is applied and predictive approach is dtermeined)

| cite | improve this answer | |
$\endgroup$

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.