title: Find distance or similarity index between two 2D arrays
body: <p>I have 2D matrices and the values are either 0 or 1. The position of 1 are different.
  How can I find similarity index between 2 matrix.</p>
  <p>For example similarity score:</p>
  <p>Matrix 1 and Matrix 2 = 0.8</p>
  <p>Matrix 1 and Matrix 3 = 0.5</p>
  <p>Matrix 1 and Matrix 4 = 0.3</p>
  <p>Which indicates Matrix 1 and matrix 2 are almost similar. The position algorithm shouldn't match the position of points strictly. If two points are visually closer or the proximity is closer, then they are similar.</p>
  <p>I tried to convert the matrix to string and then compare the strings, but it is not working.</p>
  <p><a href="https://i.stack.imgur.com/08Qgl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/08Qgl.png" alt="enter image description here" /></a></p>