diff options
author | RĂ©mi Flamary <remi.flamary@gmail.com> | 2019-07-03 14:34:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-03 14:34:13 +0200 |
commit | 952503e02b1fc9bdf0811b937baacca57e4a98f1 (patch) | |
tree | c5b1b8f10eaee4c2ecaa12f629255489c2481590 /docs/source/auto_examples/plot_OT_2D_samples.ipynb | |
parent | 8b3927bb5e8935c3dbddf054f054dc0c036fbdfe (diff) | |
parent | 7402d344240ce94e33c53daff419d4356278d48f (diff) |
Merge pull request #88 from rflamary/doc_modules
[MRG] Update documentation and add quick start guide
Diffstat (limited to 'docs/source/auto_examples/plot_OT_2D_samples.ipynb')
-rw-r--r-- | docs/source/auto_examples/plot_OT_2D_samples.ipynb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/docs/source/auto_examples/plot_OT_2D_samples.ipynb b/docs/source/auto_examples/plot_OT_2D_samples.ipynb index 26831f9..dad138b 100644 --- a/docs/source/auto_examples/plot_OT_2D_samples.ipynb +++ b/docs/source/auto_examples/plot_OT_2D_samples.ipynb @@ -26,7 +26,7 @@ }, "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" + "# Author: Remi Flamary <remi.flamary@unice.fr>\n# Kilian Fatras <kilian.fatras@irisa.fr>\n#\n# License: MIT License\n\nimport numpy as np\nimport matplotlib.pylab as pl\nimport ot\nimport ot.plot" ] }, { @@ -100,6 +100,24 @@ "source": [ "#%% sinkhorn\n\n# reg term\nlambd = 1e-3\n\nGs = ot.sinkhorn(a, b, M, lambd)\n\npl.figure(5)\npl.imshow(Gs, interpolation='nearest')\npl.title('OT matrix sinkhorn')\n\npl.figure(6)\not.plot.plot2D_samples_mat(xs, xt, Gs, color=[.5, .5, 1])\npl.plot(xs[:, 0], xs[:, 1], '+b', label='Source samples')\npl.plot(xt[:, 0], xt[:, 1], 'xr', label='Target samples')\npl.legend(loc=0)\npl.title('OT matrix Sinkhorn with samples')\n\npl.show()" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Emprirical Sinkhorn\n----------------\n\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "#%% sinkhorn\n\n# reg term\nlambd = 1e-3\n\nGes = ot.bregman.empirical_sinkhorn(xs, xt, lambd)\n\npl.figure(7)\npl.imshow(Ges, interpolation='nearest')\npl.title('OT matrix empirical sinkhorn')\n\npl.figure(8)\not.plot.plot2D_samples_mat(xs, xt, Ges, color=[.5, .5, 1])\npl.plot(xs[:, 0], xs[:, 1], '+b', label='Source samples')\npl.plot(xt[:, 0], xt[:, 1], 'xr', label='Target samples')\npl.legend(loc=0)\npl.title('OT matrix Sinkhorn from samples')\n\npl.show()" + ] } ], "metadata": { @@ -118,7 +136,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.8" } }, "nbformat": 4, |