Hi,
Since the v1.1b0 I can't use a pulled distribution. For example I can't compute the grad_log_x of a pulled distribution as in the test code below. I use python 3.6.1.
Best regards,
Paul.
import logging
import warnings
import numpy as np
import scipy.stats as stats
import TransportMaps as TM
import TransportMaps.Maps as MAPS
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)
x=np.linspace(0,10,100)[:,np.newaxis]
mu = np.array([-60])
sigma = np.array([[8]])
# Linear map
L = MAPS.LinearTransportMap(mu, sigma)
pull_L_pi = DIST.PullBackTransportMapDistribution(L,pi)
pull_L_pi.grad_x_log_pdf(x)