ott.geometry.distrib_costs.UnivariateWasserstein#
- class ott.geometry.distrib_costs.UnivariateWasserstein(ground_cost=None, solver=None, **kwargs)[source]#
1D Wasserstein cost for two 1D distributions.
This ground cost between considers vectors as a family of values. The Wasserstein distance between them is the 1D OT cost, using a user-defined ground cost.
- Parameters:
ground_cost (
Optional
[TICost
]) – Cost used to compute the 1D optimal transport between vector, should be a translation-invariant (TI) cost for correctness. IfNone
, defaults toSqEuclidean
.solver (
Optional
[UnivariateSolver
]) – 1D optimal transport solver.kwargs (
Any
) – Arguments passed on when calling theUnivariateSolver
. May include random key, or specific instructions to subsample or compute using quantiles.
Methods
all_pairs
(x, y)Compute matrix of all pairwise costs, including the
norms
.all_pairs_pairwise
(x, y)Compute matrix of all pairwise costs, excluding the
norms
.barycenter
(weights, xs)Barycentric operator.
pairwise
(x, y)Wasserstein distance between \(x\) and \(y\) seen as a 1D dist.
twist_operator
(vec, dual_vec, variable)Twist inverse operator of the cost function.
Attributes