def jacardCoefficient(a, b):
 if (a.shape != b.shape):
  raise ValueError('Arrays must be of same shape')
 length = a.shape[0]
 a = a.astype(bool)
 b = b.astype(bool)
 return (float((a == b).sum()) / length)

def jacardCoefficient ( a , b ) : if ( a . shape != b . shape ) : raise ValueError ( 'Arrays must be of same shape' ) length = a . shape [ 0 ] a = a . astype ( bool ) b = b . astype ( bool ) return ( float ( ( a == b ) . sum ( ) ) / length )
return the jacard coefficient of a and b .