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

fix ndim=1 error in samplerKwargs #70

Closed jbirky closed 3 years ago

jbirky commented 3 years ago

It looks like samplerKwargs["ndim"] = ap.theta.shape[-1] in mcmcUtils.py causes an error if ndim=1 since theta is stored as self.theta = np.array(theta).squeeze() in line 87 of approx.py which changes the shape of theta from (nsamples,1) to (nsamples,). So for 1D, ndim is being set to samplerKwargs["ndim"]=nsamples, not samplerKwargs["ndim"]=1.

dflemin3 commented 3 years ago

Thanks for these fixes and quality-of-life improvements!