prtDistanceEarthMover Earth mover distance
DIST = prtDistanceEarthMover(DS1,DS2) calculates the Earth Mover
distance from all the observations in DS1 to DS2, and ouputs a distance
matrix of size DS1.nObservations x DS2.nObservations. DS1 and DS2
should be prtDataSet objecgts. The covariance matrix in the Mahalanobis
is estimated from both the data in DS1 and DS2. DS1 and DS2 should have
the same number of features. prtDistanceEarthMover assumes that columns
represent weights for equally spaced points at locations
1:dataSet.nFeatures.
Earth mover's distance requires that the values in d1 and d2 are
positive, and they should have constant row sums for the distance to be
meaningful.
DIST = prtDistanceEarthMover(DS1,DS2,X1,X2) where X1 and
X2 are double matrices of size dataSet1.nObservations x
dataSet1.nFeatures and dataSet2.nObservations x dataSet2.nFeatures
allows the user to specify the locations of the points in each of the
data sets.
For more information, see:
http://en.wikipedia.org/wiki/Earth_mover's_distance
See also: Rubner, Tomasi, Guibas. The Earth Mover's Distance as a Metric
for Image Retrieval.
Example:
d = rand(5,3); % Generate some random data
d = bsxfun(@rdivide,d,sum(d,2)); % Normalize
% Store data in prtDataSetStandard
DS = prtDataSetStandard('Observations',d);
% Compute distance
distance = prtDistanceEarthMover(DS,DS);