EMDistance: Earth mover's distance between two sets of color clusters

View source: R/04_comparison_metrics.R

EMDistanceR Documentation

Earth mover's distance between two sets of color clusters

Description

Calculates the Earth mover's distance (briefly, the amount of work required to move the data from one distribution to resemble the other distribution, or the amount of "dirt" you have to shovel weighted by how far you have to shovel it). Accounts for both color disparity and size disparity. Recommended unless binAvg is off for histogram generation. Note: this function is not exported by the package, since it is fairly specific to the colordistance framework. For a more generic implementation of EMD, see the [emdist::emd] function in the emdist package.

Usage

EMDistance(T1, T2)

Arguments

T1

Dataframe (especially a dataframe as returned by link{extractClusters} or getImageHist, but first three columns must be coordinates).

T2

Another dataframe like T1.

Value

Earth mover's distance between the two dataframes (metric of overall bin similarity for a pair of 3-dimensional histograms).

Examples

## Not run: 
cluster.list <- colordistance::getHistList(system.file("extdata",
"Heliconius/Heliconius_B", package="colordistance"), lower=rep(0.8, 3),
upper=rep(1, 3))
colordistance:::EMDistance(cluster.list[[1]], cluster.list[[2]])

## End(Not run)

hiweller/colordistance documentation built on Feb. 1, 2024, 7:49 p.m.