title: Cosine Similarity between 2 Number Lists
body: <p>I want to calculate the <strong>cosine similarity</strong> between <strong>two lists</strong>, let's say for example list 1 which is <code>dataSetI</code> and list 2 which is <code>dataSetII</code>.</p>
  <p>Let's say <code>dataSetI</code> is <code>[3, 45, 7, 2]</code> and <code>dataSetII</code> is <code>[2, 54, 13, 15]</code>. The length of the lists are <em>always</em> equal. I want to report cosine similarity as a number between 0 and 1.</p>
  <pre class="lang-py prettyprint-override"><code>dataSetI = [3, 45, 7, 2]
  dataSetII = [2, 54, 13, 15]
  
  def cosine_similarity(list1, list2):
    # How to?
    pass
  
  print(cosine_similarity(dataSetI, dataSetII))
  </code></pre>