ott.problems.linear.potentials.DualPotentials.distance

ott.problems.linear.potentials.DualPotentials.distance#

DualPotentials.distance(src, tgt)[source]#

Evaluate Wasserstein distance between samples using dual potentials.

This uses direct estimation of potentials against measures when dual functions are provided in usual form. This expression is valid for any cost function.

When potentials are given in correlation form, as specified by the flag corr, the dual potentials solve the dual problem corresponding to the minimization of the primal OT problem where the ground cost is \(-2\langle x,y\rangle\). To recover the (squared) 2-Wasserstein distance, terms are re-arranged and contributions from squared norms are taken into account.

Parameters:
  • src (Array) – Samples from the source distribution, array of shape [n, d].

  • tgt (Array) – Samples from the target distribution, array of shape [m, d].

Return type:

float

Returns:

Wasserstein distance using specified cost function.