dflemin3 / approxposterior

A Python package for approximate Bayesian inference and optimization using Gaussian processes
https://dflemin3.github.io/approxposterior/
MIT License
41 stars 9 forks source link

log prior called twice #17

Closed dflemin3 closed 6 years ago

dflemin3 commented 6 years ago

Look prior is called twice here: mu += self._lnprior(theta_test) in _gpll(self, theta) and y_t = self._lnlike(theta_t, *args, **kwargs) + self._lnprior(theta_t) in the run method. Pretty sure the former is overkill, but verify this.

dflemin3 commented 6 years ago

Turns out I did that to ensure that theta_test was allowed by the prior. Now, I just do the following to get the same effect:

# Reject point if prior forbids it
if not np.isfinite(self._lnprior(theta_test.reshape(-1,))):
    return -np.inf