Hi,

Thank you for your software and all the support provided.

I am trying to use your TransportMaps library to solve some of my examples but I encounter some difficulties. I went back to a simple example which is not working.

I am trying to build a map between a gaussian distribution and a gumbel distribution (mu=-63, beta=3) (which is close to a posterior distribution I want to sample). When I use a standard normal gaussian distribution (rho) as reference distribution it’s working well. But when I use another gaussian distribution (mean=-60, stdd=8) (rho2) I can’t reach a good approximation building the map whatever the order of the map I use (see file attached). For me it will be easier to build the map between closer distributions. I can’t understand what I am doing wrong.

I would very appreciate if you can find some time to answer me.

Best regards,

Paul.

Here the python script I use:

```
import logging
import warnings
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import SpectralToolbox.Spectral1D as S1D
import TransportMaps as TM
import TransportMaps.Functionals as FUNC
import TransportMaps.Maps as MAPS
import scipy.io
import scipy.linalg as scila
import SpectralToolbox.SpectralND as SND
warnings.simplefilter("ignore")
TM.setLogLevel(logging.INFO)
import TransportMaps.Distributions as DIST
class GumbelDistribution(DIST.Distribution):
def __init__(self, mu, beta):
super(GumbelDistribution,self).__init__(1)
self.mu = mu
self.beta = beta
self.dist = stats.gumbel_r(loc=mu, scale=beta)
def pdf(self, x, params=None):
return self.dist.pdf(x).flatten()
def log_pdf(self, x, params=None):
return self.dist.logpdf(x).flatten()
def grad_x_log_pdf(self, x, params=None):
m = self.mu
b = self.beta
z = (x-m)/b
return (np.exp(-z)-1.)/b
def hess_x_log_pdf(self, x, params=None):
m = self.mu
b = self.beta
z = (x-m)/b
return (-np.exp(-z)/b**2.)[:,:,np.newaxis]
mu = -63.
beta = 3.
pi = GumbelDistribution(mu,beta)
M=np.array([[-50],[-70],[-60]])
xnew=np.linspace(-70,-50,201)[:,np.newaxis]
mu = np.array([-60])
sigma = np.array([[8]])
rho=DIST.StandardNormalDistribution(1)
rho2=DIST.GaussianDistribution(mu,sigma)
x = np.linspace(-70., -50., 100).reshape((100,1))
order=7
T = TM.Default_IsotropicIntegratedSquaredTriangularTransportMap(
1, order, 'full')
T2 = TM.Default_IsotropicIntegratedSquaredTriangularTransportMap(
1, order, 'full')
push_rho=DIST.PushForwardTransportMapDistribution(T,rho)
push_rho2=DIST.PushForwardTransportMapDistribution(T2,rho2)
qtype = 3 # Gauss quadrature
qparams =[20] # Quadrature order
reg = None # No regularization
tol = 1e-10 # Optimization tolerance
ders = 2 # Use gradient and Hessian
log = push_rho.minimize_kl_divergence(
pi, qtype=qtype, qparams=qparams, regularization=reg,
tol=tol, ders=ders)
log = push_rho2.minimize_kl_divergence(
pi, qtype=qtype, qparams=qparams, regularization=reg,
tol=tol, ders=ders)
plt.figure()
plt.plot(x, push_rho.pdf(x),'b',label=r'$push rho$');
plt.plot(x, push_rho2.pdf(x),'r',label=r'$push rho2$');
plt.plot(x, pi.pdf(x),'g',label=r'$\pi$');
plt.legend();
```

Best,

Paul