- class ott.solvers.linear.univariate.UnivariateSolver(num_subsamples=None, quantiles=None)#
Univariate solver to compute 1D OT distance over slices of data.
Computes 1-Dimensional optimal transport distance between two $d$-dimensional point clouds. The total distance is the sum of univariate Wasserstein distances on the $d$ slices of data: given two weighted point-clouds, stored as
[m, d]in a
LinearProblemobject, with respective weights
b, the solver computes
dOT distances between each of these
[m, 1]slices. The distance is computed using the analytical formula by default, which involves sorting each of the slices independently. The optimal transport matrices are also outputted when possible (described in sparse form, i.e. pairs of indices and mass transferred between those indices).
bare uniform, and
n=m, the computation only involves comparing sorted entries per slice, and
dassignments are given.
The user may also supply a
num_subsamplesparameter to extract as many points from the original point cloud, sampled with probability masses
b. This then simply applied the method above to the subsamples, to output
dcosts, but assignments are not provided.
When the problem is not uniform or not of equal size, the method defaults to an inversion of the CDF, and outputs both costs and transport matrix in sparse form.
quantilesargument is passed, either specifying explicit quantiles or a grid of quantiles, the distance is evaluated by comparing the quantiles of the two point clouds on each slice. The OT costs are returned but assignments are not provided.
None]) – When a vector or a number of quantiles is passed, the distance is computed by evaluating the cost function on the sectional (one for each dimension) quantiles of the two point cloud distributions described in the problem.
Number of quantiles used to evaluate OT cost.
Quantiles' values used to evaluate OT cost.