Skip to content

Commit 6ea4169

Browse files
author
ievred
committed
clean readme
1 parent d25d9e8 commit 6ea4169

File tree

1 file changed

+0
-267
lines changed

1 file changed

+0
-267
lines changed

README.md

Lines changed: 0 additions & 267 deletions
Original file line numberDiff line numberDiff line change
@@ -1,267 +0,0 @@
1-
# POT: Python Optimal Transport
2-
3-
import ot
4-
[![PyPI version](https: // badge.fury.io / py / POT.svg)](https: // badge.fury.io / py / POT)
5-
[![Anaconda Cloud](https: // anaconda.org / conda - forge / pot / badges / version.svg)](https: // anaconda.org / conda - forge / pot)
6-
[![Build Status](https: // travis - ci.org / rflamary / POT.svg?branch=master)](https: // travis - ci.org / rflamary / POT)
7-
[![Documentation Status](https: // readthedocs.org / projects / pot / badge /?version=latest)](http: // pot.readthedocs.io / en / latest /?badge=latest)
8-
[![Downloads](https: // pepy.tech / badge / pot)](https: // pepy.tech / project / pot)
9-
[![Anaconda downloads](https: // anaconda.org / conda - forge / pot / badges / downloads.svg)](https: // anaconda.org / conda - forge / pot)
10-
[![License](https: // anaconda.org / conda - forge / pot / badges / license.svg)](https: // github.com / rflamary / POT / blob / master / LICENSE)
11-
12-
13-
This open source Python library provide several solvers for optimization problems related to Optimal Transport for signal, image processing and machine learning.
14-
15-
It provides the following solvers:
16-
17-
* OT Network Flow solver for the linear program / Earth Movers Distance[1].
18-
* Entropic regularization OT solver with Sinkhorn Knopp Algorithm[2], stabilized version[9][10] and greedy Sinkhorn[22] with optional GPU implementation(requires cupy).
19-
* Sinkhorn divergence[23] and entropic regularization OT from empirical data.
20-
* Smooth optimal transport solvers(dual and semi - dual) for KL and squared L2 regularizations[17].
21-
* Non regularized Wasserstein barycenters[16] with LP solver(only small scale).
22-
* Bregman projections for Wasserstein barycenter[3], convolutional barycenter[21] and unmixing[4].
23-
* Optimal transport for domain adaptation with group lasso regularization[5]
24-
* Conditional gradient[6] and Generalized conditional gradient for regularized OT[7].
25-
* Linear OT[14] and Joint OT matrix and mapping estimation[8].
26-
* Wasserstein Discriminant Analysis[11](requires autograd + pymanopt).
27-
* Gromov - Wasserstein distances and barycenters([13] and regularized[12])
28-
* Stochastic Optimization for Large - scale Optimal Transport(semi - dual problem[18] and dual problem[19])
29-
* Non regularized free support Wasserstein barycenters[20].
30-
* Unbalanced OT with KL relaxation distance and barycenter[10, 25].
31-
* Screening Sinkhorn Algorithm for OT[26].
32-
* JCPOT algorithm for multi - source domain adaptation with target shift[27].
33-
* Partial Wasserstein and Gromov - Wasserstein(exact[29] and entropic[3] formulations).
34-
35-
Some demonstrations(both in Python and Jupyter Notebook format) are available in the examples folder.
36-
37-
#### Using and citing the toolbox
38-
39-
If you use this toolbox in your research and find it useful, please cite POT using the following bibtex reference:
40-
```
41-
42-
43-
@misc{flamary2017pot,
44-
title = {POT Python Optimal Transport library},
45-
author = {Flamary, R{'e}mi and Courty, Nicolas},
46-
url = {https: // github.com / rflamary / POT},
47-
year = {2017}
48-
}
49-
```
50-
51-
## Installation
52-
53-
The library has been tested on Linux, MacOSX and Windows. It requires a C + + compiler for building / installing the EMD solver and relies on the following Python modules:
54-
55-
- Numpy ( >= 1.11)
56-
- Scipy ( >= 1.0)
57-
- Cython ( >= 0.23)
58-
- Matplotlib ( >= 1.5)
59-
60-
#### Pip installation
61-
62-
Note that due to a limitation of pip, `cython` and `numpy` need to be installed
63-
prior to installing POT. This can be done easily with
64-
```
65-
pip install numpy cython
66-
```
67-
68-
You can install the toolbox through PyPI with:
69-
```
70-
pip install POT
71-
```
72-
or get the very latest version by downloading it and then running:
73-
```
74-
python setup.py install - -user # for user install (no root)
75-
```
76-
77-
78-
#### Anaconda installation with conda-forge
79-
80-
If you use the Anaconda python distribution, POT is available in [conda - forge](https: // conda - forge.org). To install it and the required dependencies:
81-
```
82-
conda install - c conda - forge pot
83-
```
84-
85-
#### Post installation check
86-
After a correct installation, you should be able to import the module without errors:
87-
```python
88-
```
89-
Note that for easier access the module is name ot instead of pot.
90-
91-
92-
### Dependencies
93-
94-
Some sub - modules require additional dependences which are discussed below
95-
96-
* **ot.dr ** (Wasserstein dimensionality reduction) depends on autograd and pymanopt that can be installed with:
97-
```
98-
pip install pymanopt autograd
99-
```
100-
* **ot.gpu ** (GPU accelerated OT) depends on cupy that have to be installed following instructions on[this page](https: // docs - cupy.chainer.org / en / stable / install.html).
101-
102-
103-
obviously you need CUDA installed and a compatible GPU.
104-
105-
## Examples
106-
107-
### Short examples
108-
109-
* Import the toolbox
110-
```python
111-
```
112-
* Compute Wasserstein distances
113-
```python
114-
# a,b are 1D histograms (sum to 1 and positive)
115-
# M is the ground cost matrix
116-
Wd = ot.emd2(a, b, M) # exact linear program
117-
Wd_reg = ot.sinkhorn2(a, b, M, reg) # entropic regularized OT
118-
# if b is a matrix compute all distances to a and return a vector
119-
```
120-
* Compute OT matrix
121-
```python
122-
# a,b are 1D histograms (sum to 1 and positive)
123-
# M is the ground cost matrix
124-
T = ot.emd(a, b, M) # exact linear program
125-
T_reg = ot.sinkhorn(a, b, M, reg) # entropic regularized OT
126-
```
127-
* Compute Wasserstein barycenter
128-
```python
129-
# A is a n*d matrix containing d 1D histograms
130-
# M is the ground cost matrix
131-
ba = ot.barycenter(A, M, reg) # reg is regularization parameter
132-
```
133-
134-
135-
### Examples and Notebooks
136-
137-
The examples folder contain several examples and use case for the library. The full documentation is available on [Readthedocs](http: // pot.readthedocs.io / ).
138-
139-
140-
Here is a list of the Python notebooks available [here](https: // github.com / rflamary / POT / blob / master / notebooks / ) if you want a quick look:
141-
142-
* [1D optimal transport](https: // github.com / rflamary / POT / blob / master / notebooks / plot_OT_1D.ipynb)
143-
* [OT Ground Loss](https: // github.com / rflamary / POT / blob / master / notebooks / plot_OT_L1_vs_L2.ipynb)
144-
* [Multiple EMD computation](https: // github.com / rflamary / POT / blob / master / notebooks / plot_compute_emd.ipynb)
145-
* [2D optimal transport on empirical distributions](https: // github.com / rflamary / POT / blob / master / notebooks / plot_OT_2D_samples.ipynb)
146-
* [1D Wasserstein barycenter](https: // github.com / rflamary / POT / blob / master / notebooks / plot_barycenter_1D.ipynb)
147-
* [OT with user provided regularization](https: // github.com / rflamary / POT / blob / master / notebooks / plot_optim_OTreg.ipynb)
148-
* [Domain adaptation with optimal transport](https: // github.com / rflamary / POT / blob / master / notebooks / plot_otda_d2.ipynb)
149-
* [Color transfer in images](https: // github.com / rflamary / POT / blob / master / notebooks / plot_otda_color_images.ipynb)
150-
* [OT mapping estimation for domain adaptation](https: // github.com / rflamary / POT / blob / master / notebooks / plot_otda_mapping.ipynb)
151-
* [OT mapping estimation for color transfer in images](https: // github.com / rflamary / POT / blob / master / notebooks / plot_otda_mapping_colors_images.ipynb)
152-
* [Wasserstein Discriminant Analysis](https: // github.com / rflamary / POT / blob / master / notebooks / plot_WDA.ipynb)
153-
* [Gromov Wasserstein](https: // github.com / rflamary / POT / blob / master / notebooks / plot_gromov.ipynb)
154-
* [Gromov Wasserstein Barycenter](https: // github.com / rflamary / POT / blob / master / notebooks / plot_gromov_barycenter.ipynb)
155-
* [Fused Gromov Wasserstein](https: // github.com / rflamary / POT / blob / master / notebooks / plot_fgw.ipynb)
156-
* [Fused Gromov Wasserstein Barycenter](https: // github.com / rflamary / POT / blob / master / notebooks / plot_barycenter_fgw.ipynb)
157-
158-
159-
You can also see the notebooks with [Jupyter nbviewer](https: // nbviewer.jupyter.org / github / rflamary / POT / tree / master / notebooks / ).
160-
161-
## Acknowledgements
162-
163-
This toolbox has been created and is maintained by
164-
165-
* [Rémi Flamary](http: // remi.flamary.com / )
166-
* [Nicolas Courty](http: // people.irisa.fr / Nicolas.Courty / )
167-
168-
The contributors to this library are
169-
170-
* [Alexandre Gramfort](http: // alexandre.gramfort.net / )
171-
* [Laetitia Chapel](http: // people.irisa.fr / Laetitia.Chapel / )
172-
* [Michael Perrot](http: // perso.univ - st - etienne.fr / pem82055 / ) (Mapping estimation)
173-
* [Léo Gautheron](https: // github.com / aje)(GPU implementation)
174-
* [Nathalie Gayraud](https: // www.linkedin.com / in / nathalie - t - h - gayraud /?ppe=1)
175-
* [Stanislas Chambon](https: // slasnista.github.io / )
176-
* [Antoine Rolet](https: // arolet.github.io / )
177-
* Erwan Vautier(Gromov - Wasserstein)
178-
* [Kilian Fatras](https: // kilianfatras.github.io / )
179-
* [Alain Rakotomamonjy](https: // sites.google.com / site / alainrakotomamonjy / home)
180-
* [Vayer Titouan](https: // tvayer.github.io / )
181-
* [Hicham Janati](https: // hichamjanati.github.io / ) (Unbalanced OT)
182-
* [Romain Tavenard](https: // rtavenar.github.io / ) (1d Wasserstein)
183-
* [Mokhtar Z. Alaya](http: // mzalaya.github.io / ) (Screenkhorn)
184-
185-
This toolbox benefit a lot from open source research and we would like to thank the following persons for providing some code(in various languages):
186-
187-
* [Gabriel Peyré](http: // gpeyre.github.io / ) (Wasserstein Barycenters in Matlab)
188-
* [Nicolas Bonneel](http: // liris.cnrs.fr / ~nbonneel /) (C++ code for EMD)
189-
* [Marco Cuturi](http: // marcocuturi.net / ) (Sinkhorn Knopp in Matlab/Cuda)
190-
191-
192-
## Contributions and code of conduct
193-
194-
Every contribution is welcome and should respect the[contribution guidelines](CONTRIBUTING.md). Each member of the project is expected to follow the[code of conduct](CODE_OF_CONDUCT.md).
195-
196-
## Support
197-
198-
You can ask questions and join the development discussion:
199-
200-
* On the[POT Slack channel](https: // pot - toolbox.slack.com)
201-
* On the POT [mailing list](https: // mail.python.org / mm3 / mailman3 / lists / pot.python.org / )
202-
203-
204-
You can also post bug reports and feature requests in Github issues. Make sure to read our[guidelines](CONTRIBUTING.md) first.
205-
206-
## References
207-
208-
[1] Bonneel, N., Van De Panne, M., Paris, S., & Heidrich, W. (2011, December). [Displacement interpolation using Lagrangian mass transport](https: // people.csail.mit.edu / sparis / publi / 2011 / sigasia / Bonneel_11_Displacement_Interpolation.pdf). In ACM Transactions on Graphics(TOG)(Vol. 30, No. 6, p. 158). ACM.
209-
210-
[2] Cuturi, M. (2013). [Sinkhorn distances: Lightspeed computation of optimal transport](https: // arxiv.org / pdf / 1306.0895.pdf). In Advances in Neural Information Processing Systems(pp. 2292 - 2300).
211-
212-
[3] Benamou, J. D., Carlier, G., Cuturi, M., Nenna, L., & Peyré, G. (2015). [Iterative Bregman projections for regularized transportation problems](https: // arxiv.org / pdf / 1412.5154.pdf). SIAM Journal on Scientific Computing, 37(2), A1111 - A1138.
213-
214-
[4] S. Nakhostin, N. Courty, R. Flamary, D. Tuia, T. Corpetti, [Supervised planetary unmixing with optimal transport](https: // hal.archives - ouvertes.fr / hal - 01377236 / document), Whorkshop on Hyperspectral Image and Signal Processing: Evolution in Remote Sensing(WHISPERS), 2016.
215-
216-
[5] N. Courty
217-
R. Flamary
218-
D. Tuia
219-
A. Rakotomamonjy, [Optimal Transport for Domain Adaptation](https: // arxiv.org / pdf / 1507.00504.pdf), in IEEE Transactions on Pattern Analysis and Machine Intelligence, vol.PP, no.99, pp.1 - 1
220-
221-
[6] Ferradans, S., Papadakis, N., Peyré, G., & Aujol, J. F. (2014). [Regularized discrete optimal transport](https: // arxiv.org / pdf / 1307.5551.pdf). SIAM Journal on Imaging Sciences, 7(3), 1853 - 1882.
222-
223-
[7] Rakotomamonjy, A., Flamary, R., & Courty, N. (2015). [Generalized conditional gradient: analysis of convergence and applications](https: // arxiv.org / pdf / 1510.06567.pdf). arXiv preprint arXiv: 1510.06567.
224-
225-
[8] M. Perrot, N. Courty, R. Flamary, A. Habrard(2016), [Mapping estimation for discrete optimal transport](http: // remi.flamary.com / biblio / perrot2016mapping.pdf), Neural Information Processing Systems(NIPS).
226-
227-
[9] Schmitzer, B. (2016). [Stabilized Sparse Scaling Algorithms for Entropy Regularized Transport Problems](https: // arxiv.org / pdf / 1610.06519.pdf). arXiv preprint arXiv: 1610.06519.
228-
229-
[10] Chizat, L., Peyré, G., Schmitzer, B., & Vialard, F. X. (2016). [Scaling algorithms for unbalanced transport problems](https: // arxiv.org / pdf / 1607.05816.pdf). arXiv preprint arXiv: 1607.05816.
230-
231-
[11] Flamary, R., Cuturi, M., Courty, N., & Rakotomamonjy, A. (2016). [Wasserstein Discriminant Analysis](https: // arxiv.org / pdf / 1608.08063.pdf). arXiv preprint arXiv: 1608.08063.
232-
233-
[12] Gabriel Peyré, Marco Cuturi, and Justin Solomon(2016), [Gromov - Wasserstein averaging of kernel and distance matrices](http: // proceedings.mlr.press / v48 / peyre16.html) International Conference on Machine Learning(ICML).
234-
235-
[13] Mémoli, Facundo(2011). [Gromov–Wasserstein distances and the metric approach to object matching](https: // media.adelaide.edu.au / acvt / Publications / 2011 / 2011 - Gromov % E2 % 80 % 93Wasserstein % 20Distances % 20and % 20the % 20Metric % 20Approach % 20to % 20Object % 20Matching.pdf). Foundations of computational mathematics 11.4: 417 - 487.
236-
237-
[14] Knott, M. and Smith, C. S. (1984).[On the optimal mapping of distributions](https: // link.springer.com / article / 10.1007 / BF00934745), Journal of Optimization Theory and Applications Vol 43.
238-
239-
[15] Peyré, G., & Cuturi, M. (2018). [Computational Optimal Transport](https: // arxiv.org / pdf / 1803.00567.pdf) .
240-
241-
[16] Agueh, M., & Carlier, G. (2011). [Barycenters in the Wasserstein space](https: // hal.archives - ouvertes.fr / hal - 00637399 / document). SIAM Journal on Mathematical Analysis, 43(2), 904 - 924.
242-
243-
[17] Blondel, M., Seguy, V., & Rolet, A. (2018). [Smooth and Sparse Optimal Transport](https: // arxiv.org / abs / 1710.06276). Proceedings of the Twenty - First International Conference on Artificial Intelligence and Statistics(AISTATS).
244-
245-
[18] Genevay, A., Cuturi, M., Peyré, G. & Bach, F. (2016)[Stochastic Optimization for Large - scale Optimal Transport](https: // arxiv.org / abs / 1605.08527). Advances in Neural Information Processing Systems(2016).
246-
247-
[19] Seguy, V., Bhushan Damodaran, B., Flamary, R., Courty, N., Rolet, A. & Blondel, M. [Large - scale Optimal Transport and Mapping Estimation](https: // arxiv.org / pdf / 1711.02283.pdf). International Conference on Learning Representation(2018)
248-
249-
[20] Cuturi, M. and Doucet, A. (2014)[Fast Computation of Wasserstein Barycenters](http: // proceedings.mlr.press / v32 / cuturi14.html). International Conference in Machine Learning
250-
251-
[21] Solomon, J., De Goes, F., Peyré, G., Cuturi, M., Butscher, A., Nguyen, A. & Guibas, L. (2015). [Convolutional wasserstein distances: Efficient optimal transportation on geometric domains](https: // dl.acm.org / citation.cfm?id=2766963). ACM Transactions on Graphics(TOG), 34(4), 66.
252-
253-
[22] J. Altschuler, J.Weed, P. Rigollet, (2017)[Near - linear time approximation algorithms for optimal transport via Sinkhorn iteration](https: // papers.nips.cc / paper / 6792 - near - linear - time - approximation - algorithms - for-optimal - transport - via - sinkhorn - iteration.pdf), Advances in Neural Information Processing Systems(NIPS) 31
254-
255-
[23] Aude, G., Peyré, G., Cuturi, M., [Learning Generative Models with Sinkhorn Divergences](https: // arxiv.org / abs / 1706.00292), Proceedings of the Twenty - First International Conference on Artficial Intelligence and Statistics, (AISTATS) 21, 2018
256-
257-
[24] Vayer, T., Chapel, L., Flamary, R., Tavenard, R. and Courty, N. (2019). [Optimal Transport for structured data with application on graphs](http: // proceedings.mlr.press / v97 / titouan19a.html) Proceedings of the 36th International Conference on Machine Learning(ICML).
258-
259-
[25] Frogner C., Zhang C., Mobahi H., Araya - Polo M., Poggio T. (2015). [Learning with a Wasserstein Loss](http: // cbcl.mit.edu / wasserstein / ) Advances in Neural Information Processing Systems (NIPS).
260-
261-
[26] Alaya M. Z., Bérar M., Gasso G., Rakotomamonjy A. (2019). [Screening Sinkhorn Algorithm for Regularized Optimal Transport](https: // papers.nips.cc / paper / 9386 - screening - sinkhorn - algorithm - for-regularized - optimal - transport), Advances in Neural Information Processing Systems 33 (NeurIPS).
262-
263-
[27] Redko I., Courty N., Flamary R., Tuia D. (2019). [Optimal Transport for Multi - source Domain Adaptation under Target Shift](http: // proceedings.mlr.press / v89 / redko19a.html), Proceedings of the Twenty - Second International Conference on Artificial Intelligence and Statistics(AISTATS) 22, 2019.
264-
265-
[28] Caffarelli, L. A., McCann, R. J. (2020). [Free boundaries in optimal transport and Monge - Ampere obstacle problems](http: // www.math.toronto.edu / ~mccann / papers / annals2010.pdf), Annals of mathematics, 673 - 730.
266-
267-
[29] Chapel, L., Alaya, M., Gasso, G. (2019). [Partial Gromov - Wasserstein with Applications on Positive - Unlabeled Learning](https: // arxiv.org / abs / 2002.08276), arXiv preprint arXiv: 2002.08276.

0 commit comments

Comments
 (0)