diff options
author | RĂ©mi Flamary <remi.flamary@gmail.com> | 2020-04-21 08:18:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-21 08:18:34 +0200 |
commit | 3ade772179eb0405ae6bc70cfc5e701b70d70e89 (patch) | |
tree | 1cd567393e5687f44b65157b8a9a7b7614392493 /docs/source/auto_examples/plot_OT_2D_samples.rst | |
parent | 43b2190db71b1ccbeec8fddaae23ca6af220e1b5 (diff) | |
parent | e106537ee2fd5c3b2dac87789ed9f2dc40766a55 (diff) |
Merge pull request #143 from PythonOT/doc_travis
[WIP] Update travis test and documentation (examples)
Diffstat (limited to 'docs/source/auto_examples/plot_OT_2D_samples.rst')
-rw-r--r-- | docs/source/auto_examples/plot_OT_2D_samples.rst | 121 |
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>`_ |