def _unnormalized_loglikelihood(self, x):
x = np.asanyarray(x)
ndim = x.ndim
x = x.reshape((-1, self.dim))
logpdf = -np.ones(len(x)) * np.inf
logi = self._within_bounds(x)
x = x[logi, :]
if len(x) == 0:
if ndim == 0 or (ndim == 1 and self.dim > 1):
logpdf = logpdf[0]
return logpdf
mean, var = self.model.predict(x)
logpdf[logi] = ss.norm.logcdf(self.threshold, mean, np.sqrt(var)).squeeze()
if ndim == 0 or (ndim == 1 and self.dim > 1):
logpdf = logpdf[0]
return logpdf
评论列表
文章目录