Skip to content

Commit 9a301b5

Browse files
authored
pass on readme (#234)
1 parent 13ea223 commit 9a301b5

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed

README.md

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
[![Anaconda downloads](https://anaconda.org/conda-forge/pot/badges/downloads.svg)](https://anaconda.org/conda-forge/pot)
99
[![License](https://anaconda.org/conda-forge/pot/badges/license.svg)](https://github.com/PythonOT/POT/blob/master/LICENSE)
1010

11-
1211
This open source Python library provide several solvers for optimization
1312
problems related to Optimal Transport for signal, image processing and machine
1413
learning.
@@ -51,13 +50,15 @@ Some other examples are available in the [documentation](https://pythonot.githu
5150

5251
If you use this toolbox in your research and find it useful, please cite POT
5352
using the following reference from our [JMLR paper](https://jmlr.org/papers/v22/20-451.html):
54-
```
55-
Rémi Flamary, Nicolas Courty, Alexandre Gramfort, Mokhtar Z. Alaya, Aurélie Boisbunon, Stanislas Chambon, Laetitia Chapel, Adrien Corenflos, Kilian Fatras, Nemo Fournier, Léo Gautheron, Nathalie T.H. Gayraud, Hicham Janati, Alain Rakotomamonjy, Ievgen Redko, Antoine Rolet, Antony Schutz, Vivien Seguy, Danica J. Sutherland, Romain Tavenard, Alexander Tong, Titouan Vayer;, POT Python Optimal Transport library, Journal of Machine Learning Research, 22(78):1−8, 2021.
56-
Website: https://pythonot.github.io/
57-
```
53+
54+
Rémi Flamary, Nicolas Courty, Alexandre Gramfort, Mokhtar Z. Alaya, Aurélie Boisbunon, Stanislas Chambon, Laetitia Chapel, Adrien Corenflos, Kilian Fatras, Nemo Fournier, Léo Gautheron, Nathalie T.H. Gayraud, Hicham Janati, Alain Rakotomamonjy, Ievgen Redko, Antoine Rolet, Antony Schutz, Vivien Seguy, Danica J. Sutherland, Romain Tavenard, Alexander Tong, Titouan Vayer,
55+
POT Python Optimal Transport library,
56+
Journal of Machine Learning Research, 22(78):1−8, 2021.
57+
Website: https://pythonot.github.io/
5858

5959
In Bibtex format:
60-
```
60+
61+
```bibtex
6162
@article{flamary2021pot,
6263
author = {R{\'e}mi Flamary and Nicolas Courty and Alexandre Gramfort and Mokhtar Z. Alaya and Aur{\'e}lie Boisbunon and Stanislas Chambon and Laetitia Chapel and Adrien Corenflos and Kilian Fatras and Nemo Fournier and L{\'e}o Gautheron and Nathalie T.H. Gayraud and Hicham Janati and Alain Rakotomamonjy and Ievgen Redko and Antoine Rolet and Antony Schutz and Vivien Seguy and Danica J. Sutherland and Romain Tavenard and Alexander Tong and Titouan Vayer},
6364
title = {POT: Python Optimal Transport},
@@ -83,33 +84,38 @@ The library has been tested on Linux, MacOSX and Windows. It requires a C++ comp
8384

8485
Note that due to a limitation of pip, `cython` and `numpy` need to be installed
8586
prior to installing POT. This can be done easily with
86-
```
87+
88+
```console
8789
pip install numpy cython
8890
```
8991

9092
You can install the toolbox through PyPI with:
91-
```
93+
94+
```console
9295
pip install POT
9396
```
97+
9498
or get the very latest version by running:
95-
```
99+
100+
```console
96101
pip install -U https://github.com/PythonOT/POT/archive/master.zip # with --user for user install (no root)
97102
```
98103

99-
100-
101104
#### Anaconda installation with conda-forge
102105

103106
If you use the Anaconda python distribution, POT is available in [conda-forge](https://conda-forge.org). To install it and the required dependencies:
104-
```
107+
108+
```console
105109
conda install -c conda-forge pot
106110
```
107111

108112
#### Post installation check
109113
After a correct installation, you should be able to import the module without errors:
114+
110115
```python
111116
import ot
112117
```
118+
113119
Note that for easier access the module is name ot instead of pot.
114120

115121

@@ -118,42 +124,48 @@ Note that for easier access the module is name ot instead of pot.
118124
Some sub-modules require additional dependences which are discussed below
119125

120126
* **ot.dr** (Wasserstein dimensionality reduction) depends on autograd and pymanopt that can be installed with:
121-
```
127+
128+
```shell
122129
pip install pymanopt autograd
123130
```
124-
* **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).
125131

126-
127-
obviously you need CUDA installed and a compatible GPU.
132+
* **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). Obviously you will need CUDA installed and a compatible GPU.
128133

129134
## Examples
130135

131136
### Short examples
132137

133138
* Import the toolbox
139+
134140
```python
135141
import ot
136142
```
143+
137144
* Compute Wasserstein distances
145+
138146
```python
139147
# a,b are 1D histograms (sum to 1 and positive)
140148
# M is the ground cost matrix
141-
Wd=ot.emd2(a,b,M) # exact linear program
142-
Wd_reg=ot.sinkhorn2(a,b,M,reg) # entropic regularized OT
149+
Wd = ot.emd2(a, b, M) # exact linear program
150+
Wd_reg = ot.sinkhorn2(a, b, M, reg) # entropic regularized OT
143151
# if b is a matrix compute all distances to a and return a vector
144152
```
153+
145154
* Compute OT matrix
155+
146156
```python
147157
# a,b are 1D histograms (sum to 1 and positive)
148158
# M is the ground cost matrix
149-
T=ot.emd(a,b,M) # exact linear program
150-
T_reg=ot.sinkhorn(a,b,M,reg) # entropic regularized OT
159+
T = ot.emd(a, b, M) # exact linear program
160+
T_reg = ot.sinkhorn(a, b, M, reg) # entropic regularized OT
151161
```
162+
152163
* Compute Wasserstein barycenter
164+
153165
```python
154166
# A is a n*d matrix containing d 1D histograms
155167
# M is the ground cost matrix
156-
ba=ot.barycenter(A,M,reg) # reg is regularization parameter
168+
ba = ot.barycenter(A, M, reg) # reg is regularization parameter
157169
```
158170

159171
### Examples and Notebooks
@@ -194,7 +206,6 @@ This toolbox benefit a lot from open source research and we would like to thank
194206
* [Nicolas Bonneel](http://liris.cnrs.fr/~nbonneel/) ( C++ code for EMD)
195207
* [Marco Cuturi](http://marcocuturi.net/) (Sinkhorn Knopp in Matlab/Cuda)
196208

197-
198209
## Contributions and code of conduct
199210

200211
Every contribution is welcome and should respect the [contribution guidelines](.github/CONTRIBUTING.md). Each member of the project is expected to follow the [code of conduct](.github/CODE_OF_CONDUCT.md).

0 commit comments

Comments
 (0)