@@ -39,6 +39,8 @@ It provides the following solvers:
39
39
- Screening Sinkhorn Algorithm for OT [26].
40
40
- JCPOT algorithm for multi-source domain adaptation with target shift
41
41
[27].
42
+ - Partial Wasserstein and Gromov-Wasserstein (exact [29] and entropic
43
+ [3] formulations).
42
44
43
45
Some demonstrations (both in Python and Jupyter Notebook format) are
44
46
available in the examples folder.
@@ -51,12 +53,12 @@ POT using the following bibtex reference:
51
53
52
54
::
53
55
54
- @misc{flamary2017pot,
55
- title={POT Python Optimal Transport library},
56
- author={Flamary, R{'e}mi and Courty, Nicolas},
57
- url={https://github.com/rflamary/POT},
58
- year={2017}
59
- }
56
+ @misc{flamary2017pot,
57
+ title={POT Python Optimal Transport library},
58
+ author={Flamary, R{'e}mi and Courty, Nicolas},
59
+ url={https://github.com/rflamary/POT},
60
+ year={2017}
61
+ }
60
62
61
63
Installation
62
64
------------
@@ -78,19 +80,19 @@ be installed prior to installing POT. This can be done easily with
78
80
79
81
::
80
82
81
- pip install numpy cython
83
+ pip install numpy cython
82
84
83
85
You can install the toolbox through PyPI with:
84
86
85
87
::
86
88
87
- pip install POT
89
+ pip install POT
88
90
89
91
or get the very latest version by downloading it and then running:
90
92
91
93
::
92
94
93
- python setup.py install --user # for user install (no root)
95
+ python setup.py install --user # for user install (no root)
94
96
95
97
Anaconda installation with conda-forge
96
98
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -101,7 +103,7 @@ required dependencies:
101
103
102
104
::
103
105
104
- conda install -c conda-forge pot
106
+ conda install -c conda-forge pot
105
107
106
108
Post installation check
107
109
^^^^^^^^^^^^^^^^^^^^^^^
@@ -111,7 +113,7 @@ without errors:
111
113
112
114
.. code :: python
113
115
114
- import ot
116
+ import ot
115
117
116
118
Note that for easier access the module is name ot instead of pot.
117
119
@@ -124,9 +126,9 @@ below
124
126
- **ot.dr ** (Wasserstein dimensionality reduction) depends on autograd
125
127
and pymanopt that can be installed with:
126
128
127
- ::
129
+ ::
128
130
129
- pip install pymanopt autograd
131
+ pip install pymanopt autograd
130
132
131
133
- **ot.gpu ** (GPU accelerated OT) depends on cupy that have to be
132
134
installed following instructions on `this
@@ -142,36 +144,36 @@ Short examples
142
144
143
145
- Import the toolbox
144
146
145
- .. code :: python
147
+ .. code :: python
146
148
147
- import ot
149
+ import ot
148
150
149
151
- Compute Wasserstein distances
150
152
151
- .. code :: python
153
+ .. code :: python
152
154
153
- # a,b are 1D histograms (sum to 1 and positive)
154
- # M is the ground cost matrix
155
- Wd= ot.emd2(a,b,M) # exact linear program
156
- Wd_reg= ot.sinkhorn2(a,b,M,reg) # entropic regularized OT
157
- # if b is a matrix compute all distances to a and return a vector
155
+ # a,b are 1D histograms (sum to 1 and positive)
156
+ # M is the ground cost matrix
157
+ Wd= ot.emd2(a,b,M) # exact linear program
158
+ Wd_reg= ot.sinkhorn2(a,b,M,reg) # entropic regularized OT
159
+ # if b is a matrix compute all distances to a and return a vector
158
160
159
161
- Compute OT matrix
160
162
161
- .. code :: python
163
+ .. code :: python
162
164
163
- # a,b are 1D histograms (sum to 1 and positive)
164
- # M is the ground cost matrix
165
- T= ot.emd(a,b,M) # exact linear program
166
- T_reg= ot.sinkhorn(a,b,M,reg) # entropic regularized OT
165
+ # a,b are 1D histograms (sum to 1 and positive)
166
+ # M is the ground cost matrix
167
+ T= ot.emd(a,b,M) # exact linear program
168
+ T_reg= ot.sinkhorn(a,b,M,reg) # entropic regularized OT
167
169
168
170
- Compute Wasserstein barycenter
169
171
170
- .. code :: python
172
+ .. code :: python
171
173
172
- # A is a n*d matrix containing d 1D histograms
173
- # M is the ground cost matrix
174
- ba= ot.barycenter(A,M,reg) # reg is regularization parameter
174
+ # A is a n*d matrix containing d 1D histograms
175
+ # M is the ground cost matrix
176
+ ba= ot.barycenter(A,M,reg) # reg is regularization parameter
175
177
176
178
Examples and Notebooks
177
179
~~~~~~~~~~~~~~~~~~~~~~
@@ -282,11 +284,11 @@ References
282
284
[1] Bonneel, N., Van De Panne, M., Paris, S., & Heidrich, W. (2011,
283
285
December). `Displacement interpolation using Lagrangian mass
284
286
transport <https://people.csail.mit.edu/sparis/publi/2011/sigasia/Bonneel_11_Displacement_Interpolation.pdf> `__.
285
- In ACM Transactions on Graphics (TOG) (Vol. 30, No. 6, p. 158). ACM.
287
+ In ACM Transactions on Graphics (TOG) (Vol. 30, No. 6, p. 158). ACM.
286
288
287
289
[2] Cuturi, M. (2013). `Sinkhorn distances: Lightspeed computation of
288
290
optimal transport <https://arxiv.org/pdf/1306.0895.pdf> `__. In Advances
289
- in Neural Information Processing Systems (pp. 2292-2300).
291
+ in Neural Information Processing Systems (pp. 2292-2300).
290
292
291
293
[3] Benamou, J. D., Carlier, G., Cuturi, M., Nenna, L., & Peyré, G.
292
294
(2015). `Iterative Bregman projections for regularized transportation
@@ -410,14 +412,15 @@ Shift <http://proceedings.mlr.press/v89/redko19a.html>`__, Proceedings
410
412
of the Twenty-Second International Conference on Artificial Intelligence
411
413
and Statistics (AISTATS) 22, 2019.
412
414
413
- [28] Caffarelli, L. A., McCann, R. J. (2020). [ Free boundaries in
414
- optimal transport and Monge-Ampere obstacle problems]
415
- ( http://www.math.toronto.edu/~mccann/papers/annals2010.pdf), Annals of
416
- mathematics, 673-730.
415
+ [28] Caffarelli, L. A., McCann, R. J. (2020). ` Free boundaries in
416
+ optimal transport and Monge-Ampere obstacle
417
+ problems < http://www.math.toronto.edu/~mccann/papers/annals2010.pdf> `__,
418
+ Annals of mathematics, 673-730.
417
419
418
- [29] Chapel, L., Alaya, M., Gasso, G. (2019). [Partial
419
- Gromov-Wasserstein with Applications on Positive-Unlabeled Learning"]
420
- (https://arxiv.org/abs/2002.08276), arXiv preprint arXiv:2002.08276.
420
+ [29] Chapel, L., Alaya, M., Gasso, G. (2019). `Partial
421
+ Gromov-Wasserstein with Applications on Positive-Unlabeled
422
+ Learning <https://arxiv.org/abs/2002.08276> `__, arXiv preprint
423
+ arXiv:2002.08276.
421
424
422
425
.. |PyPI version | image :: https://badge.fury.io/py/POT.svg
423
426
:target: https://badge.fury.io/py/POT
0 commit comments