Skip to content

Commit d755433

Browse files
authored
[WIP] Sinkhorn in log space (#290)
* adda sinkhorn log and working sinkhorn2 function * more tests pass * more tests pass * it works but not by default yet * remove warningd * update circleci doc * update circleci doc * new sinkhorn implemeted but not by default * better * doctest pass * test doctest * new test utils * remove pep8 errors * remove pep8 errors * doc new implementtaion with log * test sinkhorn 2 * doc for log implementation
1 parent 76450dd commit d755433

File tree

12 files changed

+403
-62
lines changed

12 files changed

+403
-62
lines changed

.circleci/config.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2
44
jobs:
55
build_docs:
66
docker:
7-
- image: circleci/python:3.7-stretch
7+
- image: cimg/python:3.9
88
steps:
99
- checkout
1010
- run:
@@ -34,18 +34,6 @@ jobs:
3434
- data-cache-0
3535
- pip-cache
3636

37-
- run:
38-
name: Spin up Xvfb
39-
command: |
40-
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset;
41-
42-
# https://github.com/ContinuumIO/anaconda-issues/issues/9190#issuecomment-386508136
43-
# https://github.com/golemfactory/golem/issues/1019
44-
- run:
45-
name: Fix libgcc_s.so.1 pthread_cancel bug
46-
command: |
47-
sudo apt-get install qt5-default
48-
4937
- run:
5038
name: Get Python running
5139
command: |

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ POT provides the following generic OT solvers (links to examples):
2020

2121
* [OT Network Simplex solver](https://pythonot.github.io/auto_examples/plot_OT_1D.html) for the linear program/ Earth Movers Distance [1] .
2222
* [Conditional gradient](https://pythonot.github.io/auto_examples/plot_optim_OTreg.html) [6] and [Generalized conditional gradient](https://pythonot.github.io/auto_examples/plot_optim_OTreg.html) for regularized OT [7].
23-
* Entropic regularization OT solver with [Sinkhorn Knopp Algorithm](https://pythonot.github.io/auto_examples/plot_OT_1D.html) [2] , stabilized version [9] [10], greedy Sinkhorn [22] and [Screening Sinkhorn [26] ](https://pythonot.github.io/auto_examples/plot_screenkhorn_1D.html).
23+
* Entropic regularization OT solver with [Sinkhorn Knopp Algorithm](https://pythonot.github.io/auto_examples/plot_OT_1D.html) [2] , stabilized version [9] [10] [34], greedy Sinkhorn [22] and [Screening Sinkhorn [26] ](https://pythonot.github.io/auto_examples/plot_screenkhorn_1D.html).
2424
* Bregman projections for [Wasserstein barycenter](https://pythonot.github.io/auto_examples/barycenters/plot_barycenter_lp_vs_entropic.html) [3], [convolutional barycenter](https://pythonot.github.io/auto_examples/barycenters/plot_convolutional_barycenter.html) [21] and unmixing [4].
2525
* Sinkhorn divergence [23] and entropic regularization OT from empirical data.
2626
* [Smooth optimal transport solvers](https://pythonot.github.io/auto_examples/plot_OT_1D_smooth.html) (dual and semi-dual) for KL and squared L2 regularizations [17].
@@ -290,3 +290,5 @@ You can also post bug reports and feature requests in Github issues. Make sure t
290290
[32] Huang, M., Ma S., Lai, L. (2021). [A Riemannian Block Coordinate Descent Method for Computing the Projection Robust Wasserstein Distance](http://proceedings.mlr.press/v139/huang21e.html), Proceedings of the 38th International Conference on Machine Learning (ICML).
291291

292292
[33] Kerdoncuff T., Emonet R., Marc S. [Sampled Gromov Wasserstein](https://hal.archives-ouvertes.fr/hal-03232509/document), Machine Learning Journal (MJL), 2021
293+
294+
[34] Feydy, J., Séjourné, T., Vialard, F. X., Amari, S. I., Trouvé, A., & Peyré, G. (2019, April). Interpolating between optimal transport and MMD using Sinkhorn divergences. In The 22nd International Conference on Artificial Intelligence and Statistics (pp. 2681-2690). PMLR.

docs/source/quickstart.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ More details about the algorithms used are given in the following note.
358358

359359
+ :code:`method='sinkhorn'` calls :any:`ot.bregman.sinkhorn_knopp` the
360360
classic algorithm [2]_.
361+
+ :code:`method='sinkhorn_log'` calls :any:`ot.bregman.sinkhorn_log` the
362+
sinkhorn algorithm in log space [2]_ that is more stable but can be
363+
slower in numpy since `logsumexp` is not implmemented in parallel.
364+
It is the recommended solver for applications that requires
365+
differentiability with a small number of iterations.
361366
+ :code:`method='sinkhorn_stabilized'` calls :any:`ot.bregman.sinkhorn_stabilized` the
362367
log stabilized version of the algorithm [9]_.
363368
+ :code:`method='sinkhorn_epsilon_scaling'` calls
@@ -389,7 +394,10 @@ More details about the algorithms used are given in the following note.
389394
solutions. Note that the greedy version of the Sinkhorn
390395
:any:`ot.bregman.greenkhorn` can also lead to a speedup and the screening
391396
version of the Sinkhorn :any:`ot.bregman.screenkhorn` aim a providing a
392-
fast approximation of the Sinkhorn problem.
397+
fast approximation of the Sinkhorn problem. For use of GPU and gradient
398+
computation with small number of iterations we strongly recommend the
399+
:any:`ot.bregman.sinkhorn_log` solver that will no need to check for
400+
numerical problems.
393401

394402

395403

0 commit comments

Comments
 (0)