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
评论列表
文章目录