summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2017-07-06 10:41:06 +0200
committerRémi Flamary <remi.flamary@gmail.com>2017-07-06 10:41:06 +0200
commitfab20da2af763d8f108e6ceb88d888fcc5497747 (patch)
tree7e4d3740343d3d66fcf2061aa0766651cd4b6d40
parent132d5471eca26923a9a6239a5ab51623f209bf39 (diff)
update readme
-rw-r--r--README.md40
-rw-r--r--docs/source/readme.rst46
-rwxr-xr-xsetup.py2
3 files changed, 80 insertions, 8 deletions
diff --git a/README.md b/README.md
index 09da51b..4aa4cc5 100644
--- a/README.md
+++ b/README.md
@@ -72,9 +72,42 @@ obviously you need CUDA installed and a compatible GPU.
## Examples
-The examples folder contain several examples and use case for the library. The full documentation is available on [Readthedocs](http://pot.readthedocs.io/)
+### Short examples
- Here is a list of the Python notebooks if you want a quick look:
+* Import the toolbox
+```python
+import ot
+```
+* Compute Wasserstein distances
+```python
+# a,b are 1D histograms (sum to 1 and positive)
+# M is the ground cost matrix
+Wd=ot.emd2(a,b,M) # exact linear program
+# if b is a matrix compute all distances to a and return a vector
+```
+* Compute OT matrix
+```python
+# a,b are 1D histograms (sum to 1 and positive)
+# M is the ground cost matrix
+Totp=ot.emd(a,b,M) # exact linear program
+Totp_reg=ot.sinkhorn(a,b,M,reg) # entropic regularized OT
+```
+* Compute Wasserstein barycenter
+```python
+# A is a n*d matrix containing d 1D histograms
+# M is the ground cost matrix
+ba=ot.barycenter(A,M,reg) # reg is regularization parameter
+```
+
+
+
+
+### Examples and Notebooks
+
+The examples folder contain several examples and use case for the library. The full documentation is available on [Readthedocs](http://pot.readthedocs.io/).
+
+
+Here is a list of the Python notebooks available [here](https://github.com/rflamary/POT/blob/master/notebooks/) if you want a quick look:
* [1D optimal transport](https://github.com/rflamary/POT/blob/master/notebooks/Demo_1D_OT.ipynb)
* [OT Ground Loss](https://github.com/rflamary/POT/blob/master/notebooks/Demo_Ground_Loss.ipynb)
@@ -88,8 +121,7 @@ The examples folder contain several examples and use case for the library. The f
* [OT mapping estimation for color transfer in images](https://github.com/rflamary/POT/blob/master/notebooks/Demo_Image_ColorAdaptation_mapping.ipynb)
* [Wasserstein Discriminant Analysis](https://github.com/rflamary/POT/blob/master/notebooks/Demo_Wasserstein_Discriminant_Analysis.ipynb)
-
-You can also see the notebooks with [Jupyter nbviewer](https://nbviewer.jupyter.org/github/rflamary/POT/tree/master/examples/).
+You can also see the notebooks with [Jupyter nbviewer](https://nbviewer.jupyter.org/github/rflamary/POT/tree/master/notebooks/).
## Acknowledgements
diff --git a/docs/source/readme.rst b/docs/source/readme.rst
index 6898296..611001b 100644
--- a/docs/source/readme.rst
+++ b/docs/source/readme.rst
@@ -93,11 +93,51 @@ obviously you need CUDA installed and a compatible GPU.
Examples
--------
+Short examples
+~~~~~~~~~~~~~~
+
+- Import the toolbox
+
+ .. code:: python
+
+ import ot
+
+- Compute Wasserstein distances
+
+ .. code:: python
+
+ # a,b are 1D histograms (sum to 1 and positive)
+ # M is the ground cost matrix
+ Wd=ot.emd2(a,b,M) # exact linear program
+ # if b is a matrix compute all distances to a and return a vector
+
+- Compute OT matrix
+
+ .. code:: python
+
+ # a,b are 1D histograms (sum to 1 and positive)
+ # M is the ground cost matrix
+ Totp=ot.emd(a,b,M) # exact linear program
+ Totp_reg=ot.sinkhorn(a,b,M,reg) # entropic regularized OT
+
+- Compute Wasserstein barycenter
+
+ .. code:: python
+
+ # A is a n*d matrix containing d 1D histograms
+ # M is the ground cost matrix
+ ba=ot.barycenter(A,M,reg) # reg is regularization parameter
+
+Examples and Notebooks
+~~~~~~~~~~~~~~~~~~~~~~
+
The examples folder contain several examples and use case for the
library. The full documentation is available on
-`Readthedocs <http://pot.readthedocs.io/>`__
+`Readthedocs <http://pot.readthedocs.io/>`__.
-Here is a list of the Python notebooks if you want a quick look:
+Here is a list of the Python notebooks available
+`here <https://github.com/rflamary/POT/blob/master/notebooks/>`__ if you
+want a quick look:
- `1D optimal
transport <https://github.com/rflamary/POT/blob/master/notebooks/Demo_1D_OT.ipynb>`__
@@ -123,7 +163,7 @@ Here is a list of the Python notebooks if you want a quick look:
Analysis <https://github.com/rflamary/POT/blob/master/notebooks/Demo_Wasserstein_Discriminant_Analysis.ipynb>`__
You can also see the notebooks with `Jupyter
-nbviewer <https://nbviewer.jupyter.org/github/rflamary/POT/tree/master/examples/>`__.
+nbviewer <https://nbviewer.jupyter.org/github/rflamary/POT/tree/master/notebooks/>`__.
Acknowledgements
----------------
diff --git a/setup.py b/setup.py
index 347c882..9e08ccc 100755
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ __version__ = re.search(
ROOT = os.path.abspath(os.path.dirname(__file__))
-# convert markdown readme to rst in pypandoc installed
+# convert markdown readme to rst if pypandoc installed
try:
import pypandoc
README = pypandoc.convert('README.md', 'rst')