Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,5 @@ You can also post bug reports and feature requests in Github issues. Make sure t
[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.

[12] Gabriel Peyré, Marco Cuturi, and Justin Solomon, [Gromov-Wasserstein averaging of kernel and distance matrices](http://proceedings.mlr.press/v48/peyre16.html) International Conference on Machine Learning (ICML). 2016.

[13] Mémoli, Facundo. [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 (2011): 417-487.
2 changes: 1 addition & 1 deletion docs/cache_nbrun
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"plot_otda_mapping_colors_images.ipynb": "4f0587a00a3c082799a75a0ed36e9ce1", "plot_optim_OTreg.ipynb": "71d3c106b3f395a6b1001078a6ca6f8d", "plot_otda_color_images.ipynb": "d047d635f4987c81072383241590e21f", "plot_WDA.ipynb": "27f8de4c6d7db46497076523673eedfb", "plot_OT_L1_vs_L2.ipynb": "e15219bf651a7e39e7c5c3934069894c", "plot_barycenter_1D.ipynb": "6fd8167f98816dc832fe0c58b1d5527b", "plot_otda_classes.ipynb": "44bb8cd93317b5d342cd62e26d9bbe60", "plot_otda_d2.ipynb": "8ac4fd2ff899df0858ce1e5fead37f33", "plot_otda_mapping.ipynb": "d335a15af828aaa3439a1c67570d79d6", "plot_gromov.ipynb": "9d0893ec68851f200d0ca806bcbe847f", "plot_compute_emd.ipynb": "bd95981189df6adcb113d9b360ead734", "plot_OT_1D.ipynb": "e44c83f6112388ae18657cb0ad76d0e9", "plot_gromov_barycenter.ipynb": "a4d9636685394ceb13f26cdc613b9b5b", "plot_otda_semi_supervised.ipynb": "0261d339a692e339e15d3634488905cc", "plot_OT_2D_samples.ipynb": "3f125714daa35ff3cfe5dae1f71265c4"}
{"plot_otda_mapping_colors_images.ipynb": "4f0587a00a3c082799a75a0ed36e9ce1", "plot_optim_OTreg.ipynb": "2ec33a099bb67120a134332a20f29313", "plot_otda_color_images.ipynb": "d047d635f4987c81072383241590e21f", "plot_WDA.ipynb": "27f8de4c6d7db46497076523673eedfb", "plot_OT_L1_vs_L2.ipynb": "871d60931f5118c085342e11cb638336", "plot_barycenter_1D.ipynb": "95708b025b6d96d97f579d30d268cbff", "plot_otda_classes.ipynb": "44bb8cd93317b5d342cd62e26d9bbe60", "plot_otda_d2.ipynb": "1a9547f07317612e1a161b7d9f07a5a8", "plot_otda_mapping.ipynb": "d335a15af828aaa3439a1c67570d79d6", "plot_gromov.ipynb": "825d79eba255314fe11469c64d38fc3d", "plot_compute_emd.ipynb": "bd95981189df6adcb113d9b360ead734", "plot_OT_1D.ipynb": "54dfea8ccb61f30729519275785c494c", "plot_gromov_barycenter.ipynb": "953e5047b886ec69ec621ec52f5e21d1", "plot_otda_semi_supervised.ipynb": "0261d339a692e339e15d3634488905cc", "plot_OT_2D_samples.ipynb": "3f125714daa35ff3cfe5dae1f71265c4"}
7 changes: 7 additions & 0 deletions docs/source/all.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ ot.bregman
.. automodule:: ot.bregman
:members:

ot.gromov
----------

.. automodule:: ot.gromov
:members:


ot.optim
--------

Expand Down
Binary file modified docs/source/auto_examples/auto_examples_jupyter.zip
Binary file not shown.
Binary file modified docs/source/auto_examples/auto_examples_python.zip
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/auto_examples/images/sphx_glr_plot_gromov_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/auto_examples/images/sphx_glr_plot_gromov_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/auto_examples/images/sphx_glr_plot_gromov_003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/auto_examples/images/sphx_glr_plot_otda_d2_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/auto_examples/images/sphx_glr_plot_otda_d2_003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/auto_examples/images/sphx_glr_plot_otda_d2_006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 22 additions & 13 deletions docs/source/auto_examples/index.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
:orphan:

POT Examples
============

This is a gallery of all the POT example files.



.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of EMD and Sinkhorn transport plans and their visualiz...">
Expand Down Expand Up @@ -145,13 +149,13 @@ This is a gallery of all the POT example files.

.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of regularized Wassersyein Barycenter as proposed in [...">
<div class="sphx-glr-thumbcontainer" tooltip="OT for domain adaptation with image color adaptation [6] with mapping estimation [8].">

.. only:: html

.. figure:: /auto_examples/images/thumb/sphx_glr_plot_barycenter_1D_thumb.png
.. figure:: /auto_examples/images/thumb/sphx_glr_plot_otda_mapping_colors_images_thumb.png

:ref:`sphx_glr_auto_examples_plot_barycenter_1D.py`
:ref:`sphx_glr_auto_examples_plot_otda_mapping_colors_images.py`

.. raw:: html

Expand All @@ -161,17 +165,17 @@ This is a gallery of all the POT example files.
.. toctree::
:hidden:

/auto_examples/plot_barycenter_1D
/auto_examples/plot_otda_mapping_colors_images

.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="OT for domain adaptation with image color adaptation [6] with mapping estimation [8].">
<div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the computation of regularized Wassersyein Barycenter as proposed in [...">

.. only:: html

.. figure:: /auto_examples/images/thumb/sphx_glr_plot_otda_mapping_colors_images_thumb.png
.. figure:: /auto_examples/images/thumb/sphx_glr_plot_barycenter_1D_thumb.png

:ref:`sphx_glr_auto_examples_plot_otda_mapping_colors_images.py`
:ref:`sphx_glr_auto_examples_plot_barycenter_1D.py`

.. raw:: html

Expand All @@ -181,7 +185,7 @@ This is a gallery of all the POT example files.
.. toctree::
:hidden:

/auto_examples/plot_otda_mapping_colors_images
/auto_examples/plot_barycenter_1D

.. raw:: html

Expand Down Expand Up @@ -308,19 +312,24 @@ This is a gallery of all the POT example files.



.. container:: sphx-glr-footer
.. only :: html

.. container:: sphx-glr-footer


.. container:: sphx-glr-download

:download:`Download all examples in Python source code: auto_examples_python.zip </auto_examples/auto_examples_python.zip>`
:download:`Download all examples in Python source code: auto_examples_python.zip <//home/rflamary/PYTHON/POT/docs/source/auto_examples/auto_examples_python.zip>`



.. container:: sphx-glr-download

:download:`Download all examples in Jupyter notebooks: auto_examples_jupyter.zip </auto_examples/auto_examples_jupyter.zip>`
:download:`Download all examples in Jupyter notebooks: auto_examples_jupyter.zip <//home/rflamary/PYTHON/POT/docs/source/auto_examples/auto_examples_jupyter.zip>`


.. only:: html

.. rst-class:: sphx-glr-signature
.. rst-class:: sphx-glr-signature

`Generated by Sphinx-Gallery <http://sphinx-gallery.readthedocs.io>`_
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
170 changes: 85 additions & 85 deletions docs/source/auto_examples/plot_OT_1D.ipynb
Original file line number Diff line number Diff line change
@@ -1,126 +1,126 @@
{
"nbformat_minor": 0,
"nbformat": 4,
"cells": [
{
"execution_count": null,
"cell_type": "code",
"source": [
"%matplotlib inline"
],
"outputs": [],
"execution_count": null,
"metadata": {
"collapsed": false
}
},
},
"outputs": [],
"source": [
"%matplotlib inline"
],
"cell_type": "code"
},
{
"metadata": {},
"source": [
"\n# 1D optimal transport\n\n\nThis example illustrates the computation of EMD and Sinkhorn transport plans\nand their visualization.\n\n\n"
],
"cell_type": "markdown",
"metadata": {}
},
],
"cell_type": "markdown"
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# Author: Remi Flamary <remi.flamary@unice.fr>\n#\n# License: MIT License\n\nimport numpy as np\nimport matplotlib.pylab as pl\nimport ot\nfrom ot.datasets import get_1D_gauss as gauss"
],
"outputs": [],
"execution_count": null,
"metadata": {
"collapsed": false
}
},
},
"outputs": [],
"source": [
"# Author: Remi Flamary <remi.flamary@unice.fr>\n#\n# License: MIT License\n\nimport numpy as np\nimport matplotlib.pylab as pl\nimport ot\nimport ot.plot\nfrom ot.datasets import get_1D_gauss as gauss"
],
"cell_type": "code"
},
{
"metadata": {},
"source": [
"Generate data\n-------------\n\n"
],
"cell_type": "markdown",
"metadata": {}
},
],
"cell_type": "markdown"
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"#%% parameters\n\nn = 100 # nb bins\n\n# bin positions\nx = np.arange(n, dtype=np.float64)\n\n# Gaussian distributions\na = gauss(n, m=20, s=5) # m= mean, s= std\nb = gauss(n, m=60, s=10)\n\n# loss matrix\nM = ot.dist(x.reshape((n, 1)), x.reshape((n, 1)))\nM /= M.max()"
],
"outputs": [],
"execution_count": null,
"metadata": {
"collapsed": false
}
},
},
"outputs": [],
"source": [
"#%% parameters\n\nn = 100 # nb bins\n\n# bin positions\nx = np.arange(n, dtype=np.float64)\n\n# Gaussian distributions\na = gauss(n, m=20, s=5) # m= mean, s= std\nb = gauss(n, m=60, s=10)\n\n# loss matrix\nM = ot.dist(x.reshape((n, 1)), x.reshape((n, 1)))\nM /= M.max()"
],
"cell_type": "code"
},
{
"metadata": {},
"source": [
"Plot distributions and loss matrix\n----------------------------------\n\n"
],
"cell_type": "markdown",
"metadata": {}
},
],
"cell_type": "markdown"
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"#%% plot the distributions\n\npl.figure(1, figsize=(6.4, 3))\npl.plot(x, a, 'b', label='Source distribution')\npl.plot(x, b, 'r', label='Target distribution')\npl.legend()\n\n#%% plot distributions and loss matrix\n\npl.figure(2, figsize=(5, 5))\not.plot.plot1D_mat(a, b, M, 'Cost matrix M')"
],
"outputs": [],
"execution_count": null,
"metadata": {
"collapsed": false
}
},
},
"outputs": [],
"source": [
"#%% plot the distributions\n\npl.figure(1, figsize=(6.4, 3))\npl.plot(x, a, 'b', label='Source distribution')\npl.plot(x, b, 'r', label='Target distribution')\npl.legend()\n\n#%% plot distributions and loss matrix\n\npl.figure(2, figsize=(5, 5))\not.plot.plot1D_mat(a, b, M, 'Cost matrix M')"
],
"cell_type": "code"
},
{
"metadata": {},
"source": [
"Solve EMD\n---------\n\n"
],
"cell_type": "markdown",
"metadata": {}
},
],
"cell_type": "markdown"
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"#%% EMD\n\nG0 = ot.emd(a, b, M)\n\npl.figure(3, figsize=(5, 5))\not.plot.plot1D_mat(a, b, G0, 'OT matrix G0')"
],
"outputs": [],
"execution_count": null,
"metadata": {
"collapsed": false
}
},
},
"outputs": [],
"source": [
"#%% EMD\n\nG0 = ot.emd(a, b, M)\n\npl.figure(3, figsize=(5, 5))\not.plot.plot1D_mat(a, b, G0, 'OT matrix G0')"
],
"cell_type": "code"
},
{
"metadata": {},
"source": [
"Solve Sinkhorn\n--------------\n\n"
],
"cell_type": "markdown",
"metadata": {}
},
],
"cell_type": "markdown"
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"#%% Sinkhorn\n\nlambd = 1e-3\nGs = ot.sinkhorn(a, b, M, lambd, verbose=True)\n\npl.figure(4, figsize=(5, 5))\not.plot.plot1D_mat(a, b, Gs, 'OT matrix Sinkhorn')\n\npl.show()"
],
"outputs": [],
"execution_count": null,
"metadata": {
"collapsed": false
}
},
"outputs": [],
"source": [
"#%% Sinkhorn\n\nlambd = 1e-3\nGs = ot.sinkhorn(a, b, M, lambd, verbose=True)\n\npl.figure(4, figsize=(5, 5))\not.plot.plot1D_mat(a, b, Gs, 'OT matrix Sinkhorn')\n\npl.show()"
],
"cell_type": "code"
}
],
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"name": "python2",
"language": "python"
},
"language_info": {
"mimetype": "text/x-python",
"nbconvert_exporter": "python",
"name": "python",
"file_extension": ".py",
"version": "2.7.12",
"pygments_lexer": "ipython2",
"name": "python",
"codemirror_mode": {
"version": 2,
"name": "ipython"
}
"name": "ipython",
"version": 3
},
"nbconvert_exporter": "python",
"version": "3.5.2",
"pygments_lexer": "ipython3",
"file_extension": ".py",
"mimetype": "text/x-python"
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3",
"language": "python"
}
}
},
"nbformat_minor": 0,
"nbformat": 4
}
1 change: 1 addition & 0 deletions docs/source/auto_examples/plot_OT_1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import numpy as np
import matplotlib.pylab as pl
import ot
import ot.plot
from ot.datasets import get_1D_gauss as gauss

##############################################################################
Expand Down
14 changes: 10 additions & 4 deletions docs/source/auto_examples/plot_OT_1D.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and their visualization.
import numpy as np
import matplotlib.pylab as pl
import ot
import ot.plot
from ot.datasets import get_1D_gauss as gauss


Expand Down Expand Up @@ -171,11 +172,13 @@ Solve Sinkhorn
110|1.527180e-10|


**Total running time of the script:** ( 0 minutes 1.198 seconds)
**Total running time of the script:** ( 0 minutes 1.061 seconds)



.. container:: sphx-glr-footer
.. only :: html

.. container:: sphx-glr-footer


.. container:: sphx-glr-download
Expand All @@ -188,6 +191,9 @@ Solve Sinkhorn

:download:`Download Jupyter notebook: plot_OT_1D.ipynb <plot_OT_1D.ipynb>`

.. rst-class:: sphx-glr-signature

`Generated by Sphinx-Gallery <http://sphinx-gallery.readthedocs.io>`_
.. only:: html

.. rst-class:: sphx-glr-signature

`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
Loading