# Earth mover's distance

In computer science, the earth mover's distance (EMD) is a measure of the distance between two probability distributions over a region D. In mathematics, this is known as the Wasserstein metric. Informally, if the distributions are interpreted as two different ways of piling up a certain amount of dirt over the region D, the EMD is the minimum cost of turning one pile into the other; where the cost is assumed to be amount of dirt moved times the distance by which it is moved [1].

The above definition is valid only if the two distributions have the same integral (informally, if the two piles have the same amount of dirt), as in normalized histograms orprobability density functions. In that case, the EMD is equivalent to the 1st Mallows distance or 1st Wasserstein distance between the two distributions [2] [3].

## Extensions

Some applications may require the comparison of distributions with different total masses. One approach is to allow for a partial match, where dirt from the most massive distribution is rearranged to make the least massive, and any leftover "dirt" is discarded at no cost. Under this approach, the EMD is no longer a true distance between distributions. Another approach is to allow for mass to be created or destroyed, on a global and/or local level, as an alternative to transportation, but with a cost penalty. In that case one must specify a real parameter σ, the ratio between the cost of creating or destroying one unit of "dirt", and the cost of transporting it by a unit distance. This is equivalent to minimizing the sum of the earth moving cost plus σ times the L1 distance between the rearranged pile and the second distribution.

## Computing the EMD

If the domain D is discrete, the EMD can be computed by solving an instance transportation problem, which can be solved by the so-called Hungarian algorithm. In particular, ifD is a one-dimensional array of "bins" the EMD can be efficiently computed by scanning the array and keeping track of how much dirt needs to be transported between consecutive bins.

References

2.                             ^ Elizaveta Levina; Peter Bickel (2001). "The EarthMover’s Distance is the Mallows Distance: Some Insights from Statistics". Proceedings of ICCV 2001 (Vancouver, Canada): 251–256.

3.                             ^ C. L. Mallows (1972). "A note on asymptotic joint normality". Annals of Mathematical Statistics 43 (2): 508–515. doi:10.1214/aoms/1177692631.

4.                             a b S. Peleg; M. Werman, and H. Rom (1989). "A unified approach to the change of resolution: Space and gray-level". IEEE Transactions on Pattern Analysis and Machine Intelligence 11: 739–742.doi:10.1109/34.192468.

5.                             ^ "Mémoire sur la théorie des déblais et des remblais". Histoire de l’Académie Royale des Science, Année 1781, avec les Mémoires de Mathématique et de Physique. 1781.

6.                             ^ J. Stolfi, personal communication to L. J. Guibas, 1994

7.                             ^ Yossi Rubner; Carlo Tomasi, Leonidas J. Guibas (1998). "A Metric for Distributions with Applications to Image Databases". Proceedings ICCV 1998: 59–66.

————罗方炜译

http://en.wikipedia.org/wiki/Transportation_problem