title: How to compute weighted cosine similarity between two vectores in Python
body: <p>Hi i'm trying to calculate the cosine similarity between two vectors. I'm using scipy to do so. </p>
  
  <pre><code>&gt;&gt;&gt; from scipy import spatial
  &gt;&gt;&gt; 1 - spatial.distance.cosine([3, 45, 7, 2], [2, 54, 13, 15])
  0.97228425171234989
  
  &gt;&gt;&gt; 1 - spatial.distance.cosine([3, 45, 7, 2], [6, 54, 13, 15])
  0.97216484313108098
  </code></pre>
  
  <p>But if i bring minor change in first element i get almost same similarity. But my first element of vector is very important and minor change means a lot to me. So i was wondering how can i add weight for each index of vector to get weighted cosine similarity between two vectors. Thanks</p>