Skip to content

Distance

Distance metrics for comparing simulated and observed data in ABC.

Standard Distance Metrics

l1

L1 (Manhattan) distance between observations.

approxbayescomp.distance.l1(x, y)

l2

L2 (Euclidean) distance between observations.

approxbayescomp.distance.l2(x, y)

Distribution Distances

wasserstein

1D Wasserstein (Earth Mover's) distance between empirical distributions.

approxbayescomp.distance.wasserstein = (sorted, l1_scaled) module-attribute

wasserstein2D

2D Wasserstein distance for bivariate observations.

approxbayescomp.distance.wasserstein2D(x, y)

Compute the Wasserstein using the Hungarian algorithm.

Parameters:

Name Type Description Default
x n*2 arrays, where n is the sample size
required
y n*2 arrays, where n is the sample size
required

Returns:

Type Description
scalar
The Wasserstein distance between the 2D samples

Specialized Distances

wrap_ss_curve_matching

Wrapper for curve matching distance using summary statistics.

approxbayescomp.distance.wrap_ss_curve_matching(gamma)