summaryrefslogtreecommitdiff
path: root/docs/source/auto_examples/plot_OT_2D_samples.rst
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2020-04-20 15:19:09 +0200
committerRémi Flamary <remi.flamary@gmail.com>2020-04-20 15:19:09 +0200
commite65606ae498bd611f6a994868c2a66dfbea403cd (patch)
treeb9b43dcaf8499b6d57b806ce04350fb6b792537f /docs/source/auto_examples/plot_OT_2D_samples.rst
parent8acaf262baa04a4d2bdd9c774c45c5bb2fb2d12a (diff)
big update examples
Diffstat (limited to 'docs/source/auto_examples/plot_OT_2D_samples.rst')
-rw-r--r--docs/source/auto_examples/plot_OT_2D_samples.rst121
1 files changed, 79 insertions, 42 deletions
diff --git a/docs/source/auto_examples/plot_OT_2D_samples.rst b/docs/source/auto_examples/plot_OT_2D_samples.rst
index 1f1d713..460bb95 100644
--- a/docs/source/auto_examples/plot_OT_2D_samples.rst
+++ b/docs/source/auto_examples/plot_OT_2D_samples.rst
@@ -1,6 +1,12 @@
+.. only:: html
+
+ .. note::
+ :class: sphx-glr-download-link-note
+ Click :ref:`here <sphx_glr_download_auto_examples_plot_OT_2D_samples.py>` to download the full example code
+ .. rst-class:: sphx-glr-example-title
-.. _sphx_glr_auto_examples_plot_OT_2D_samples.py:
+ .. _sphx_glr_auto_examples_plot_OT_2D_samples.py:
====================================================
@@ -12,8 +18,7 @@ sum of diracs. The OT matrix is plotted with the samples.
-
-.. code-block:: python
+.. code-block:: default
# Author: Remi Flamary <remi.flamary@unice.fr>
@@ -32,15 +37,13 @@ sum of diracs. The OT matrix is plotted with the samples.
+
Generate data
-------------
+.. code-block:: default
-.. code-block:: python
-
-
- #%% parameters and data generation
n = 50 # nb samples
@@ -65,15 +68,13 @@ Generate data
+
Plot data
---------
+.. code-block:: default
-.. code-block:: python
-
-
- #%% plot samples
pl.figure(1)
pl.plot(xs[:, 0], xs[:, 1], '+b', label='Source samples')
@@ -94,25 +95,31 @@ Plot data
*
.. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_001.png
- :scale: 47
+ :class: sphx-glr-multi-img
*
.. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_002.png
- :scale: 47
+ :class: sphx-glr-multi-img
+.. rst-class:: sphx-glr-script-out
+ Out:
-Compute EMD
------------
+ .. code-block:: none
+
+
+ Text(0.5, 1.0, 'Cost matrix M')
-.. code-block:: python
+Compute EMD
+-----------
+
+.. code-block:: default
- #%% EMD
G0 = ot.emd(a, b, M)
@@ -136,26 +143,32 @@ Compute EMD
*
- .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_005.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_003.png
+ :class: sphx-glr-multi-img
*
- .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_006.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_004.png
+ :class: sphx-glr-multi-img
+.. rst-class:: sphx-glr-script-out
+ Out:
-Compute Sinkhorn
-----------------
+ .. code-block:: none
+ Text(0.5, 1.0, 'OT matrix with samples')
-.. code-block:: python
- #%% sinkhorn
+Compute Sinkhorn
+----------------
+
+
+.. code-block:: default
+
# reg term
lambd = 1e-3
@@ -184,26 +197,33 @@ Compute Sinkhorn
*
- .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_009.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_005.png
+ :class: sphx-glr-multi-img
*
- .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_010.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_006.png
+ :class: sphx-glr-multi-img
+.. rst-class:: sphx-glr-script-out
+ Out:
-Emprirical Sinkhorn
-----------------
+ .. code-block:: none
+
+ /home/rflamary/PYTHON/POT/examples/plot_OT_2D_samples.py:103: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
+ pl.show()
-.. code-block:: python
+
+Emprirical Sinkhorn
+----------------
- #%% sinkhorn
+.. code-block:: default
+
# reg term
lambd = 1e-3
@@ -230,38 +250,55 @@ Emprirical Sinkhorn
*
- .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_013.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_007.png
+ :class: sphx-glr-multi-img
*
- .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_014.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_OT_2D_samples_008.png
+ :class: sphx-glr-multi-img
.. rst-class:: sphx-glr-script-out
- Out::
+ Out:
+
+ .. code-block:: none
+ /home/rflamary/PYTHON/POT/ot/bregman.py:363: RuntimeWarning: divide by zero encountered in true_divide
+ v = np.divide(b, KtransposeU)
Warning: numerical errors at iteration 0
+ /home/rflamary/PYTHON/POT/ot/plot.py:90: RuntimeWarning: invalid value encountered in double_scalars
+ if G[i, j] / mx > thr:
+ /home/rflamary/PYTHON/POT/examples/plot_OT_2D_samples.py:128: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
+ pl.show()
+
-**Total running time of the script:** ( 0 minutes 2.616 seconds)
+.. rst-class:: sphx-glr-timing
+
+ **Total running time of the script:** ( 0 minutes 2.154 seconds)
+
+
+.. _sphx_glr_download_auto_examples_plot_OT_2D_samples.py:
+
.. only :: html
.. container:: sphx-glr-footer
+ :class: sphx-glr-footer-example
+
- .. container:: sphx-glr-download
+ .. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_OT_2D_samples.py <plot_OT_2D_samples.py>`
- .. container:: sphx-glr-download
+ .. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_OT_2D_samples.ipynb <plot_OT_2D_samples.ipynb>`
@@ -270,4 +307,4 @@ Emprirical Sinkhorn
.. rst-class:: sphx-glr-signature
- `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
+ `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_