It may seem a silly question that, how to compare two matrices with the same dimension by Hamming distance?

$$d^{HD}(i,j) = \sum_{k=0}^{n-1} [y_{ik}\neq y_{jk} ]$$

  • Is it Simply sum(abs(B-A)) where A and B are the matrices?
  • Is it used for weighted matrices or just used for binary ones?

In some packages like Scipy, pdist(X,"hamming")

Computes the normalized Hamming distance, or the proportion of those vector elements between two n-vectors u and v which disagree. To save memory, the matrix X can be of type boolean. The output is a matrix n by n(squareform).

I don't know how to apply for matrices?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.