pyml.utils.metrics.manhatten_distance#

manhatten_distance(x1, x2)[source]#

Computes the manhatten distance for two matrix-like objects :rtype: ndarray

\[d(A,B)=\sum _{i}\left|A_{i}-B_{i}\right|\]
Parameters:
  • x1 (numpy.ndarray) – Input matrix

  • x2 (numpy.ndarray) – Input matrix The shapes of x1 and x2 must be compatible in terms of matching column number.

Returns:

computed distance using the manhatten metric

Return type:

numpy.ndarray