def sample(self, model):
if not model.has_data:
return np.zeros(0) # TODO this should be a sample from the prior...
prior_cov = model.noiseless_kernel.cov(model.inputs)
prior_cov_chol = spla.cholesky(prior_cov, lower=True)
# Here get the Cholesky from model
params_array = hyperparameter_utils.params_to_array(self.params)
for i in xrange(self.thinning + 1):
params_array, current_ll = elliptical_slice(
params_array,
self.logprob,
prior_cov_chol,
model.mean.value,
model,
**self.sampler_options
)
hyperparameter_utils.set_params_from_array(self.params, params_array)
self.current_ll = current_ll # for diagnostics
# xx: the initial point
# sample_nu: a function that samples from the multivariate Gaussian prior
# log_like_fn: a function that computes the log likelihood of an input
# cur_log_like (optional): the current log likelihood
# angle_range: not sure
elliptical_slice_sampler.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录