Skip to content

0.9.2

Compare
Choose a tag to compare
@rflamary rflamary released this 22 Dec 12:20
· 60 commits to master since this release
5c28c18

This new release contains several new features and bug fixes. Among the new features
we have a new solver for estimation of nearest Brenier potentials (SSNB) that can be used for OT mapping estimation (on small problems), new Bregman Alternated Projected Gradient solvers for GW and FGW, and new solvers for Bures-Wasserstein barycenters. We also provide a first solver for Low Rank Sinkhorn that will be ussed to provide low rak OT extensions in the next releases. Finally we have a new exact line-search for (F)GW solvers with KL loss that can be used to improve the convergence of the solvers.

We also have a new LazyTensor class that can be used to model OT plans and low rank tensors in large scale OT. This class is used to return the plan for the new wrapper for geomloss Sinkhorn solver on empirical samples that can lead to x10/x100 speedups on CPU or GPU and have a lazy implementation that allows solving very large problems of a few millions samples.

We also have a new API for solving OT problems from empirical samples with ot.solve_sample Finally we have a new API for Gromov-Wasserstein solvers with ot.solve_gromov function that centralizes most of the (F)GW methods with unified notation. Some example of how to use the new API below:

# Generate random data
xs, xt = np.random.randn(100, 2), np.random.randn(50, 2)

# Solve OT problem with empirical samples
sol = ot.solve_sample(xs, xt) # Exact OT betwen smaples with uniform weights
sol = ot.solve_sample(xs, xt, wa, wb) # Exact OT with weights given by user 

sol = ot.solve_sample(xs, xt, reg= 1, metric='euclidean') # sinkhorn with euclidean metric

sol = ot.solve_sample(xs, xt, reg= 1, method='geomloss') # faster sinkhorn solver on CPU/GPU

sol = ot.solve_sample(x,x2, method='factored', rank=10) # compute factored OT

sol = ot.solve_sample(x,x2, method='lowrank', rank=10) # compute lowrank sinkhorn OT

value_bw = ot.solve_sample(xs, xt, method='gaussian').value # Bures-Wasserstein distance

# Solve GW problem 
Cs, Ct = ot.dist(xs, xs), ot.dist(xt, xt) # compute cost matrices
sol = ot.solve_gromov(Cs,Ct) # Exact GW between samples with uniform weights

# Solve FGW problem
M = ot.dist(xs, xt) # compute cost matrix

# Exact FGW between samples with uniform weights
sol = ot.solve_gromov(Cs, Ct, M, loss='KL', alpha=0.7) # FGW with KL data fitting  


# recover solutions objects
P = sol.plan # OT plan
u, v = sol.potentials # dual variables
value = sol.value # OT value

# for GW and FGW
value_linear = sol.value_linear # linear part of the loss
value_quad = sol.value_quad # quadratic part of the loss 

Users are encouraged to use the new API (it is much simpler) but it might still be subjects to small changes before the release of POT 1.0.

We also fixed a number of issues, the most pressing being a problem of GPU memory allocation when pytorch is installed that will not happen now thanks to Lazy initialization of the backends. We now also have the possibility to deactivate some backends using environment which prevents POT from importing them and can lead to large import speedup.

New features

  • Added support for Nearest Brenier Potentials (SSNB) (PR #526) + minor fix (PR #535)
  • Tweaked get_backend to ignore None inputs (PR #525)
  • Callbacks for generalized conditional gradient in ot.da.sinkhorn_l1l2_gl are now vectorized to improve performance (PR #507)
  • The linspace method of the backends now has the type_as argument to convert to the same dtype and device. (PR #533)
  • The convolutional_barycenter2d and convolutional_barycenter2d_debiased functions now work with different devices.. (PR #533)
  • New API for Gromov-Wasserstein solvers with ot.solve_gromov function (PR #536)
  • New LP solvers from scipy used by default for LP barycenter (PR #537)
  • Update wheels to Python 3.12 and remove old i686 arch that do not have scipy wheels (PR #543)
  • Upgraded unbalanced OT solvers for more flexibility (PR #539)
  • Add LazyTensor for modeling plans and low rank tensor in large scale OT (PR #544)
  • Add exact line-search for gromov_wasserstein and fused_gromov_wasserstein with KL loss (PR #556)
  • Add KL loss to all semi-relaxed (Fused) Gromov-Wasserstein solvers (PR #559)
  • Further upgraded unbalanced OT solvers for more flexibility and future use (PR #551)
  • New API function ot.solve_sample for solving OT problems from empirical samples (PR #563)
  • Wrapper for `geomloss`` solver on empirical samples (PR #571)
  • Add stop_criterion feature to (un)regularized (f)gw barycenter solvers (PR #578)
  • Add fixed_structure and fixed_features to entropic fgw barycenter solver (PR #578)
  • Add new BAPG solvers with KL projections for GW and FGW (PR #581)
  • Add Bures-Wasserstein barycenter in ot.gaussian and example (PR #582, PR #584)
  • Domain adaptation method SinkhornL1l2Transport now supports JAX backend (PR #587)
  • Added support for Low-Rank Sinkhorn Factorization (PR #568)

Closed issues

  • Fix line search evaluating cost outside of the interpolation range (Issue #502, PR #504)
  • Lazily instantiate backends to avoid unnecessary GPU memory pre-allocations on package import (Issue #516, PR #520)
  • Handle documentation and warnings when integers are provided to (f)gw solvers based on cg (Issue #530, PR #559)
  • Correct independence of fgw_barycenters to init_C and init_X (Issue #547, PR #566)
  • Avoid precision change when computing norm using PyTorch backend (Discussion #570, PR #572)
  • Create ot/bregman/repository (Issue #567, PR #569)
  • Fix matrix feature shape in entropic_fused_gromov_barycenters(Issue #574, PR #573)
  • Fix (fused) gromov-wasserstein barycenter solvers to support kl_loss(PR #576)

New Contributors

Full Changelog: 0.9.1...0.9.2