diff options
Diffstat (limited to 'docs/source/auto_examples/plot_compute_emd.rst')
-rw-r--r-- | docs/source/auto_examples/plot_compute_emd.rst | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/docs/source/auto_examples/plot_compute_emd.rst b/docs/source/auto_examples/plot_compute_emd.rst index 27bca2c..e4cc143 100644 --- a/docs/source/auto_examples/plot_compute_emd.rst +++ b/docs/source/auto_examples/plot_compute_emd.rst @@ -1,6 +1,12 @@ +.. only:: html + + .. note:: + :class: sphx-glr-download-link-note + Click :ref:`here <sphx_glr_download_auto_examples_plot_compute_emd.py>` to download the full example code + .. rst-class:: sphx-glr-example-title -.. _sphx_glr_auto_examples_plot_compute_emd.py: + .. _sphx_glr_auto_examples_plot_compute_emd.py: ================= @@ -13,8 +19,7 @@ ground metrics and plot their values for diffeent distributions. - -.. code-block:: python +.. code-block:: default # Author: Remi Flamary <remi.flamary@unice.fr> @@ -33,15 +38,13 @@ ground metrics and plot their values for diffeent distributions. + Generate data ------------- +.. code-block:: default -.. code-block:: python - - - #%% parameters n = 100 # nb bins n_target = 50 # nb target distributions @@ -72,16 +75,14 @@ Generate data + Plot data --------- - -.. code-block:: python +.. code-block:: default - #%% plot the distributions - pl.figure(1) pl.subplot(2, 1, 1) pl.plot(x, a, 'b', label='Source distribution') @@ -96,7 +97,8 @@ Plot data .. image:: /auto_examples/images/sphx_glr_plot_compute_emd_001.png - :align: center + :class: sphx-glr-single-img + @@ -105,11 +107,8 @@ Compute EMD for the different losses ------------------------------------ +.. code-block:: default -.. code-block:: python - - - #%% Compute and plot distributions and loss matrix d_emd = ot.emd2(a, B, M) # direct computation of EMD d_emd2 = ot.emd2(a, B, M2) # direct computation of EMD with loss M2 @@ -124,21 +123,27 @@ Compute EMD for the different losses -.. image:: /auto_examples/images/sphx_glr_plot_compute_emd_003.png - :align: center +.. image:: /auto_examples/images/sphx_glr_plot_compute_emd_002.png + :class: sphx-glr-single-img +.. rst-class:: sphx-glr-script-out + Out: -Compute Sinkhorn for the different losses ------------------------------------------ + .. code-block:: none + <matplotlib.legend.Legend object at 0x7f4c7389f438> -.. code-block:: python - #%% +Compute Sinkhorn for the different losses +----------------------------------------- + + +.. code-block:: default + reg = 1e-2 d_sinkhorn = ot.sinkhorn2(a, B, M, reg) d_sinkhorn2 = ot.sinkhorn2(a, B, M2, reg) @@ -156,28 +161,45 @@ Compute Sinkhorn for the different losses -.. image:: /auto_examples/images/sphx_glr_plot_compute_emd_004.png - :align: center +.. image:: /auto_examples/images/sphx_glr_plot_compute_emd_003.png + :class: sphx-glr-single-img + + +.. rst-class:: sphx-glr-script-out + Out: + .. code-block:: none + /home/rflamary/PYTHON/POT/examples/plot_compute_emd.py:102: 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 0.446 seconds) + +.. rst-class:: sphx-glr-timing + + **Total running time of the script:** ( 0 minutes 0.436 seconds) + + +.. _sphx_glr_download_auto_examples_plot_compute_emd.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_compute_emd.py <plot_compute_emd.py>` - .. container:: sphx-glr-download + .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_compute_emd.ipynb <plot_compute_emd.ipynb>` @@ -186,4 +208,4 @@ Compute Sinkhorn for the different losses .. 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>`_ |