ott.problems.linear.potentials.DualPotentials#
- class ott.problems.linear.potentials.DualPotentials(f, g, *, cost_fn, corr=False)[source]#
The Kantorovich dual potential functions \(f\) and \(g\).
\(f\) and \(g\) are a pair of functions, candidates for the dual OT Kantorovich problem, supposedly optimal for a given pair of measures.
- Parameters:
f (
Callable
[[Array
],float
]) – The first dual potential function.g (
Callable
[[Array
],float
]) – The second dual potential function.cost_fn (
CostFn
) – The cost function used to solve the OT problem.corr (
bool
) – Whether the duals solve the problem in distance form, or correlation form (as used for instance for ICNNs, see, e.g., top right of p.3 in [Makkuva et al., 2020])
Methods
distance
(src, tgt)Evaluate 2-Wasserstein distance between samples using dual potentials.
plot_ot_map
(source, target[, forward, ax, ...])Plot data and learned optimal transport map.
plot_potential
([forward, quantile, ax, ...])Plot the potential.
transport
(vec[, forward])Transport
vec
according to Brenier formula [Brenier, 1991].Attributes
The first dual potential function.
The second dual potential function.