Sponsored Links

Rabu, 20 Desember 2017

Sponsored Links

By George Kour Supervised By: Prof. Dana Ron Dr. Raid Saabne - ppt ...
src: slideplayer.com

In statistics, 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.

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 or probability density functions. In that case, the EMD is equivalent to the 1st Mallows distance or 1st Wasserstein distance between the two distributions.


Video Earth mover's distance



Theory

Assume that we have a set of points in R d {\textstyle \mathbb {R} ^{d}} (dimension d {\textstyle d} ). Instead of assigning one distribution to the set of points, we can cluster them and represent the point set in terms of the clusters. Thus, each cluster is a single point in R d {\textstyle \mathbb {R} ^{d}} and the weight of the cluster is decided by the fraction of the distribution present in that cluster. This representation of a distribution by a set of clusters is called the signature. Two signatures can have different sizes, for example, a bimodal distribution has shorter signature (2 clusters) than complex ones. One cluster representation (mean or mode in R d {\textstyle \mathbb {R} ^{d}} ) can be thought of as a single feature in a signature. The distance between each of the features is called as ground distance.

The EMD problem can be solved as a transportation problem. Suppose that several suppliers, each with a given amount of goods, are required to supply several consumers, each with a given limited capacity. For each supplier-consumer pair, the cost of transporting a single unit of goods is given. The transportation problem is then to find a least-expensive flow of goods from the suppliers to the consumers that satisfies the consumers' demand. Similarly, here the problem is transforming one signature( P {\textstyle P} ) to another( Q {\textstyle Q} ) with minimum work done.

Assume that signature P {\textstyle P} has m {\textstyle m} clusters with P = { ( p 1 , w p 1 ) , ( p 2 , w p 2 ) , . . . , ( p m , w p m ) } {\textstyle P=\{(p_{1},w_{p1}),(p_{2},w_{p2}),...,(p_{m},w_{pm})\}} , where p i {\textstyle p_{i}} is the cluster representative and w p i {\textstyle w_{pi}} is the weight of the cluster. Similarly another signature Q = { ( q 1 , w q 1 ) , ( q 2 , w q 2 ) , . . . , ( q n , w q n ) } {\textstyle Q=\{(q_{1},w_{q1}),(q_{2},w_{q2}),...,(q_{n},w_{qn})\}} has n {\textstyle n} clusters. Let D = [ d i , j ] {\textstyle D=[d_{i,j}]} be the ground distance between clusters p i {\textstyle p_{i}} and q j {\textstyle q_{j}} .

We want to find a flow F = [ f i , j ] {\textstyle F=[f_{i,j}]} , with f i , j {\textstyle f_{i,j}} the flow between p i {\textstyle p_{i}} and q j {\textstyle q_{j}} , that minimizes the overall cost.

min ? i = 1 m ? j = 1 n f i , j d i , j {\displaystyle \min {\sum _{i=1}^{m}\sum _{j=1}^{n}f_{i,j}d_{i,j}}}

subjected to the constraints:

f i , j >= 0 , 1 <= i <= m , 1 <= j <= n {\displaystyle f_{i,j}\geq 0,1\leq i\leq m,1\leq j\leq n}
? j = 1 n f i , j <= w p i , 1 <= i <= m {\displaystyle \sum _{j=1}^{n}{f_{i,j}}\leq w_{pi},1\leq i\leq m}
? i = 1 m f i , j <= w q j , 1 <= j <= n {\displaystyle \sum _{i=1}^{m}{f_{i,j}}\leq w_{qj},1\leq j\leq n}
? i = 1 m ? j = 1 n f i , j = min {   ? i = 1 m w p i , ? j = 1 n w q j   } {\displaystyle \sum _{i=1}^{m}\sum _{j=1}^{n}f_{i,j}=\min \left\{\ \sum _{i=1}^{m}w_{pi},\quad \sum _{j=1}^{n}w_{qj}\ \right\}}

The optimal flow F {\textstyle F} is found by solving this linear optimization problem. The earth mover's distance is defined as the work normalized by the total flow:

E M D ( P , Q ) = ? i = 1 m ? j = 1 n f i , j d i , j ? i = 1 m ? j = 1 n f i , j {\displaystyle EMD(P,Q)={\frac {\sum _{i=1}^{m}\sum _{j=1}^{n}f_{i,j}d_{i,j}}{\sum _{i=1}^{m}\sum _{j=1}^{n}f_{i,j}}}}

Maps Earth mover's distance



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.

Notationally, if ? : P -> Q {\displaystyle \pi :P\to Q} is a partial function which is a bijection on subsets P ? ? P {\displaystyle P'\subset P} and Q ? ? Q {\displaystyle Q'\subset Q} , then one is interested in the distance function

| P - Q | ? = | P \ P ? | + | Q \ Q ? | {\displaystyle |P-Q|_{\pi }=|P\setminus P'|+|Q\setminus Q'|}

where P \ P ? {\displaystyle P\setminus P'} denotes set minus. Here, P ? {\displaystyle P'} would be the portion of the earth that was moved; thus P \ P ? {\displaystyle P\setminus P'} would be the portion not moved, and | P \ P ? | {\displaystyle |P\setminus P'|} the size of the pile not moved. By symmetry, one contemplates Q ? ? Q {\displaystyle Q'\subset Q} as the pile at the destination that 'got there' from P, as compared to the total Q that we want to have there. Formally, this distance indicates how much an injective correspondence differs from an isomorphism.


Word mover distance by Rishabh Goel 4:58 - YouTube
src: i.ytimg.com


Computing the EMD

EMD can be computed by solving an instance of transportation problem, using any algorithm for minimum cost flow problem, e.g. the network simplex algorithm.

Hungarian algorithm can be used to get the solution if the domain D is the set {0,1}. If the domain is integral, it can be translated for the same algorithm by representing integral bins as multiple binary bins.

As a special case, if D 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:

EMD 0 = 0 EMD i + 1 = P i + EMD i - Q i Total Distance = ? | EMD i | {\displaystyle {\begin{array}{rl}{\text{EMD}}_{0}&=0\\{\text{EMD}}_{i+1}&=P_{i}+{\text{EMD}}_{i}-Q_{i}\\{\text{Total Distance}}&=\sum |{\text{EMD}}_{i}|\end{array}}}

Uncovering the Horseshoe Effect in Microbial Analyses | mSystems
src: msystems.asm.org


EMD-based similarity analysis

EMD-based similarity analysis (EMDSA) is an important and effective tool in many multimedia information retrieval and pattern recognition applications. However, the computational cost of EMD is super-cubic to the number of the "bins" given an arbitrary "D". Efficient and scalable EMD computation techniques for large scale data have been investigated using MapReduce, as well as bulk synchronous parallel and resilient distributed dataset.


11.3 Linear Programming | 11 Optimization | Pattern Recognition ...
src: i.ytimg.com


Applications

An early application of the EMD in computer science was to compare two grayscale images that may differ due to dithering, blurring, or local deformations. In this case, the region is the image's domain, and the total amount of light (or ink) is the "dirt" to be rearranged.

The EMD is widely used in content-based image retrieval to compute distances between the color histograms of two digital images. In this case, the region is the RGB color cube, and each image pixel is a parcel of "dirt". The same technique can be used for any other quantitative pixel attribute, such as luminance, gradient, apparent motion in a video frame, etc..

More generally, the EMD is used in pattern recognition to compare generic summaries or surrogates of data records called signatures. A typical signature consists of list of pairs ((x1,m1), ... (xn,mn)), where each xi is a certain "feature" (e.g., color in an image, letter in a text, etc.), and mi is "mass" (how many times that feature occurs in the record). Alternatively, xi may be the centroid of a data cluster, and mi the number of entities in that cluster. To compare two such signatures with the EMD, one must define a distance between features, which is interpreted as the cost of turning a unit mass of one feature into a unit mass of the other. The EMD between two signatures is then the minimum cost of turning one of them into the other.


Opencv tutorial. (Lecture 2) - презентация онлайн
src: cf.ppt-online.org


History

The concept was first introduced by Gaspard Monge in 1781, and anchors the field of transportation theory. The use of the EMD as a distance measure for monochromatic images was described in 1989 by S. Peleg, M. Werman and H. Rom. The name "earth movers' distance" was proposed by J. Stolfi in 1994, and was used in print in 1998 by Y. Rubner, C. Tomasi and L. G. Guibas.


Visualization and cellular hierarchy inference of single-cell data ...
src: media.springernature.com


References


Uncovering the Horseshoe Effect in Microbial Analyses | mSystems
src: msystems.asm.org


External links

  • C code for the Earth Mover's Distance
  • Python2 wrapper for the C implementation of the Earth Mover's Distance
  • C++ and Matlab and Java wrappers code for the Earth Mover's Distance, especially efficient for thresholded ground distances
  • Java implementation of a generic generator for evaluating large-scale Earth Mover's Distance based similarity analysis

Source of the article : Wikipedia

Comments
0 Comments