def sokalmichener(u, v):
 u = _validate_vector(u)
 v = _validate_vector(v)
 if (u.dtype == bool):
  ntt = (u & v).sum()
  nff = ((~ u) & (~ v)).sum()
 else:
  ntt = (u * v).sum()
  nff = ((1.0 - u) * (1.0 - v)).sum()
 (nft, ntf) = _nbool_correspond_ft_tf(u, v)
 return (float((2.0 * (ntf + nft))) / float(((ntt + nff) + (2.0 * (ntf + nft)))))

def sokalmichener ( u , v ) : u = _validate_vector ( u ) v = _validate_vector ( v ) if ( u . dtype == bool ) : ntt = ( u & v ) . sum ( ) nff = ( ( ~ u ) & ( ~ v ) ) . sum ( ) else : ntt = ( u * v ) . sum ( ) nff = ( ( 1.0 - u ) * ( 1.0 - v ) ) . sum ( ) ( nft , ntf ) = _nbool_correspond_ft_tf ( u , v ) return ( float ( ( 2.0 * ( ntf + nft ) ) ) / float ( ( ( ntt + nff ) + ( 2.0 * ( ntf + nft ) ) ) ) )
computes the sokal-michener dissimilarity between two boolean 1-d arrays .