From 38e96f88eb520b9fa8333686565b082d2921e131 Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Tue, 13 Jun 2017 15:50:11 +0200 Subject: implement paralell sinkhorn stabilized --- examples/plot_OT_2D_samples.py | 4 ++-- examples/plot_compute_emd.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/plot_OT_2D_samples.py b/examples/plot_OT_2D_samples.py index 3b95083..edfb781 100644 --- a/examples/plot_OT_2D_samples.py +++ b/examples/plot_OT_2D_samples.py @@ -13,7 +13,7 @@ import ot #%% parameters and data generation -n=2 # nb samples +n=50 # nb samples mu_s=np.array([0,0]) cov_s=np.array([[1,0],[0,1]]) @@ -62,7 +62,7 @@ pl.title('OT matrix with samples') #%% sinkhorn # reg term -lambd=5e-3 +lambd=5e-4 Gs=ot.sinkhorn(a,b,M,lambd) diff --git a/examples/plot_compute_emd.py b/examples/plot_compute_emd.py index 226bc97..08de6ee 100644 --- a/examples/plot_compute_emd.py +++ b/examples/plot_compute_emd.py @@ -16,7 +16,7 @@ from ot.datasets import get_1D_gauss as gauss #%% parameters n=100 # nb bins -n_target=10 # nb target distributions +n_target=50 # nb target distributions # bin positions @@ -61,14 +61,15 @@ pl.legend() #%% reg=1e-2 -d_sinkhorn=ot.sinkhorn(a,B,M,reg) +d_sinkhorn=ot.sinkhorn(a,B,M,reg,method='sinkhorn_stabilized') +d_sinkhorn0=ot.sinkhorn(a,B,M,reg) d_sinkhorn2=ot.sinkhorn(a,B,M2,reg) pl.figure(2) pl.clf() pl.plot(d_emd,label='Euclidean EMD') pl.plot(d_emd2,label='Squared Euclidean EMD') -pl.plot(d_sinkhorn,label='Euclidean Sinkhorn') -pl.plot(d_emd2,label='Squared Euclidean Sinkhorn') +pl.plot(d_sinkhorn,'+',label='Euclidean Sinkhorn') +pl.plot(d_sinkhorn2,'+',label='Squared Euclidean Sinkhorn') pl.title('EMD distances') pl.legend() \ No newline at end of file -- cgit v1.2.3