ott.tools#
The tools package contains high level functions that build on
outputs produced by lower-level components in the toolbox, such as
solvers.
In particular, we provide user-friendly APIs to unregularized OT quantities, such as the Wasserstein distance for two point clouds of the same size. We also provide functions to pad efficiently point clouds when doing large scale OT between them in parallel, implementations of the Sinkhorn divergence [Genevay et al., 2018, Séjourné et al., 2019], sliced Wasserstein distances [Rabin et al., 2012], differentiable approximations to ranks and quantile functions [Cuturi et al., 2019], and various tools to study Gaussians with the 2-Wasserstein distance [Delon and Desolneux, 2020, Gelbrich, 1990].
Unregularized Optimal Transport#
|
Solve matching problem using the Hungarian algorithm. |
|
Compute the Wasserstein distance, uses Hungarian algorithm. |
Segmented Sinkhorn#
|
Compute regularized OT cost between subsets of vectors in |
Sinkhorn Divergence#
|
Wrapper to get the Sinkhorn divergence between two point clouds. |
Compute Sinkhorn divergence between two measures. |
|
Holds the outputs of a call to |
|
Compute Sinkhorn divergence between subsets of vectors in x and y. |
Sliced Wasserstein Distance#
|
Project data on directions sampled randomly from sphere. |
|
Compute the Sliced Wasserstein distance between two weighted point clouds. |
ProgOT#
|
Progressive Entropic Optimal Transport solver [Kassraie et al., 2024]. |
|
Output of the |
|
Get the step size schedule. |
|
Get the epsilon regularization schedule. |
Conformal Prediction#
|
Optimal transport conformal prediction [Klein et al., 2025]. |
|
Sample target measure for |
Soft Sorting Algorithms#
Returns multivariate CDF and quantile maps, given input samples. |
|
|
Apply the soft quantiles operator on the input tensor. |
|
Re-normalize inputs so that its quantiles match those of targets/weights. |
|
Soft quantizes an input according using |
|
Apply the soft rank operator on input tensor. |
|
Apply the soft sort operator on a given axis of the input. |
|
Sort a multidimensional array according to a real valued criterion. |
|
Soft \(\text{top-}k\) selection mask. |
Clustering#
|
K-means clustering using Lloyd's algorithm [Lloyd, 1982]. |
|
Output of the |
Plotting#
|
Plot an optimal transport map between two point clouds. |
|
Plots an optimal transport map for |
|
Create animated visualizations of optimal transport and flow matching. |
ott.tools.gaussian_mixture package#
This package implements various tools to manipulate Gaussian mixtures with a slightly modified Wasserstein geometry: here a Gaussian mixture is no longer strictly regarded as a density \(\mathbb{R}^d\), but instead as a point cloud in the space of Gaussians in \(\mathbb{R}^d\). This viewpoint provides a new approach to compare, and fit Gaussian mixtures, as described for instance in [Delon and Desolneux, 2020] and references therein.
Gaussian Mixtures#
|
Normal distribution. |
|
Gaussian Mixture model. |
Coupled pair of Gaussian mixture models. |
|
|
Initialize a GMM via K-means++ with retries on failure. |
|
Fit a GMM using the EM algorithm. |
|
Get a function that performs penalized EM. |