From 0a4030fd809f677a4723b1cf38d6409b44160533 Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Thu, 27 Oct 2016 17:39:39 +0200 Subject: Demo 2D samples --- examples/demo_OT_2D_samples.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'examples/demo_OT_2D_samples.py') diff --git a/examples/demo_OT_2D_samples.py b/examples/demo_OT_2D_samples.py index 5fc214f..e9ec78a 100644 --- a/examples/demo_OT_2D_samples.py +++ b/examples/demo_OT_2D_samples.py @@ -9,9 +9,7 @@ import numpy as np import matplotlib.pylab as pl import ot - - -#%% parameters +#%% parameters and data generation n=20 # nb samples @@ -24,7 +22,7 @@ cov_t=np.array([[1,-.8],[-.8,1]]) xs=ot.datasets.get_2D_samples_gauss(n,mu_s,cov_s) xt=ot.datasets.get_2D_samples_gauss(n,mu_t,cov_t) -a,b = ot.unif(n),ot.unif(n) +a,b = ot.unif(n),ot.unif(n) # uniform distribution on samples # loss matrix M=ot.dist(xs,xt) @@ -47,7 +45,6 @@ pl.title('Cost matrix M') G0=ot.emd(a,b,M) - pl.figure(3) pl.imshow(G0,interpolation='nearest') pl.title('OT matrix G0') @@ -78,14 +75,4 @@ pl.plot(xt[:,0],xt[:,1],'xr',label='Target samples') pl.legend(loc=0) pl.title('OT matrix Sinkhorn with samples') -# -#pl.figure(3) -#ot.plot.otplot1D(a,b,G0,'OT matrix G0') -# -##%% Sinkhorn -# -#lambd=1e-3 -#Gs=ot.sinkhorn(a,b,M,lambd) -# -#pl.figure(4) -#ot.plot.otplot1D(a,b,Gs,'OT matrix Sinkhorn') + -- cgit v1.2.3