def _log_pdf(self, x): assert x.shape[-1] == self.mu.size if x.ndim == 1: squeeze = True x = broadcast_to(x, (1, self.mu.size)) else: squeeze = False assert x.ndim == 2 d = x - self.mu d = d.transpose() logp = ( -0.5 * (solve(self.cov, d) * d).sum(axis=0) - (self.mu.size * 0.5) * log(2 * np.pi) - 0.5 * logdet(self.cov) ) if squeeze: logp = logp.sum() return logp
def _log_pdf(self, x): try: return -SigmoidCrossEntropy().forward(self.logit, x) except AttributeError: return x * log(self.mu) + (1 - x) * log(1 - self.mu)
def _log_pdf(self, x): try: return -SoftmaxCrossEntropy(axis=self.axis).forward(self.logit, x) except (KeyError, AttributeError): return (x * log(self.mu).sum(axis=self.axis))
def _log_pdf(self, x): return (log(gamma(self.alpha.sum(axis=self.axis))) + sum( (self.alpha - 1) * log(x) - log(gamma(self.alpha)), axis=self.axis))
def _log_pdf(self, x): return -self.rate * x + log(self.rate)
def _log_pdf(self, x): return log(self.pdf(x))
def _log_pdf(self, x): return (self.shape * log(self.rate) + (self.shape - 1) * log(x) - self.rate * x - log(gamma(self.shape)))
def _log_pdf(self, x): return (-np.log(np.pi) - log(self.scale) - log(1 + square((x - self.loc) / self.scale)))
def _log_pdf(self, x): return np.log(0.5) - abs(x - self.loc) / self.scale - log(self.scale)