Relation between countries and capital

I’m sorry. You’re right - I made a big mistake :flushed: not a “slight” mistake :blush:

  # Cosine similarity: country (4, 2); Turkey(3, 1) = 0.9899
  (4*3 + 2*1) / ((4**2 + 2**2)**0.5 * (3**2 + 1**2)**0.5)

  # Cosine similarity: country (4, 2); Japan(4, 3) = 0.9839
  (4*4 + 2*3) / ((4**2 + 2**2)**0.5 * (4**2 + 3**2)**0.5)

Your initial calculations were correct. I’m sorry about that.

1 Like