def hamming(u, v):
 u = _validate_vector(u)
 v = _validate_vector(v)
 if (u.shape != v.shape):
  raise ValueError('The 1d arrays must have equal lengths.')
 return (u != v).mean()

def hamming ( u , v ) : u = _validate_vector ( u ) v = _validate_vector ( v ) if ( u . shape != v . shape ) : raise ValueError ( 'The 1d arrays must have equal lengths.' ) return ( u != v ) . mean ( )
computes the hamming distance between two 1-d arrays .