def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if x not in [0, 1]: return -float('inf') return Bernoulli.calc_predictive_logp(x, self.N, self.x_sum, self.alpha, self.beta)
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if x < 0: return -float('inf') return Exponential.calc_predictive_logp(x, self.N, self.sum_x, self.a, self.b)
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if not (x % 1 == 0 and x >= 0): return -float('inf') return Poisson.calc_predictive_logp(x, self.N, self.sum_x, self.a, self.b)
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if not (x % 1 == 0 and 0 <= x < self.k): return -float('inf') return Categorical.calc_predictive_logp(int(x), self.N, self.counts, self.alpha)
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if not (0 <= x <= 2 * pi): return -float('inf') return Vonmises.calc_predictive_logp(x, self.N, self.sum_sin_x, self.sum_cos_x, self.a, self.b, self.k)
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if x <= 0: return -float('inf') return - log(x) + \ Normal.calc_predictive_logp( log(x), self.N, self.sum_log_x, self.sum_log_x_sq, self.m, self.r, self.s, self.nu)
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if not (self.l <= x <= self.h): return -float('inf') logpdf_unorm = NormalTrunc.calc_predictive_logp( x, self.mu, self.sigma, self.l, self.h) logcdf_norm = NormalTrunc.calc_log_normalizer(self.mu, self.sigma, self.l, self.h) return logpdf_unorm - logcdf_norm
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] if not 0 < x < 1: return -float('inf') return Beta.calc_predictive_logp(x, self.strength, self.balance)
def logpdf(self, rowid, targets, constraints=None, inputs=None): DistributionGpm.logpdf(self, rowid, targets, constraints, inputs) x = targets[self.outputs[0]] return Normal.calc_predictive_logp(x, self.N, self.sum_x, self.sum_x_sq, self.m, self.r, self.s, self.nu)