Пример #1
0
 def symbolic_logq_not_scaled(self):
     z0 = self.symbolic_initial
     std = rho2sigma(self.rho)
     logdet = at.log(std)
     quaddist = -0.5 * z0**2 - at.log((2 * np.pi)**0.5)
     logq = quaddist - logdet
     return logq.sum(range(1, logq.ndim))
Пример #2
0
 def L(self):
     if self.batched:
         L = at.zeros((self.ddim, self.ddim, self.bdim))
         L = at.set_subtensor(L[self.tril_indices],
                              self.params_dict["L_tril"].T)
         L = L.dimshuffle(2, 0, 1)
     else:
         L = at.zeros((self.ddim, self.ddim))
         L = at.set_subtensor(L[self.tril_indices],
                              self.params_dict["L_tril"])
     Ld = L[..., np.arange(self.ddim), np.arange(self.ddim)]
     L = at.set_subtensor(Ld, rho2sigma(Ld))
     return L
Пример #3
0
 def std(self):
     return rho2sigma(self.rho)
Пример #4
0
 def cov(self):
     var = rho2sigma(self.rho)**2
     if self.batched:
         return batched_diag(var)
     else:
         return at.diag(var)
Пример #5
0
 def symbolic_logq_not_scaled(self):
     z0 = self.symbolic_initial
     std = rho2sigma(self.rho)
     logdet = at.log(std)
     logq = pm.Normal.dist().logp(z0) - logdet
     return logq.sum(range(1, logq.ndim))
Пример #6
0
 def cov(self):
     var = rho2sigma(self.rho) ** 2
     return at.diag(var)
Пример #7
0
 def L(self):
     L = at.zeros((self.ddim, self.ddim))
     L = at.set_subtensor(L[self.tril_indices], self.params_dict["L_tril"])
     Ld = L[..., np.arange(self.ddim), np.arange(self.ddim)]
     L = at.set_subtensor(Ld, rho2sigma(Ld))
     return L
Пример #8
0
 def __init__(self, rho=None, **kwargs):
     super().__init__(**kwargs)
     rho = self.add_param(rho, "rho")
     self.scale = rho2sigma(rho)
     self.shared_params = dict(rho=rho)