title: Do tf-idf weights affect the cosine similarity?
body: <p>I'm clustering text documents. I'm using tf-idf and cosine similarity. However there's something I don't really understand even tho I'm using these measures. Do the tf-idf weights affect the similarity calculations between two documents?</p>
  
  <p>Suppose I have these two documents:</p>
  
  <p>1- High trees.</p>
  
  <p>2- High trees High trees High trees High trees.</p>
  
  <p>Then the similarity between the two documents will be 1, although the tf-idf vectors of the two documents are different. Where the second should normally have higher weights for the terms compared to the first document. </p>
  
  <p>Suppose the weights for the two vectors are (just suppose):</p>
  
  <p>v1(1.0, 1.0)</p>
  
  <p>v2(5.0, 8.0)</p>
  
  <p>calculating the cosine similarity gives 1.0.</p>
  
  <p>Here is a sketch of two random vectors that share the same terms but with different weights. </p>
  
  <p>There's an obvious angel between the vectors, so the weights should play a role!</p>
  
  <p><img src="https://i.stack.imgur.com/SVPzt.png" alt="enter image description here"></p>
  
  <p>This triggers the question, where do the tf/idf weights play a role in the similarity calculations? Because what I understood so far is that the similarity here only cares about the presence and absence of the terms.</p>