我正在尝试在使用 emcee 之前使用高斯,但似乎无法完全弄清楚。基本上我想更换
def lnprior(theta):
a, b, c = theta
if 1.0 < a < 2.0 and 1.0 < b < 2.0 and 1.0 < c < 2.0:
return 0.0
return -np.inf
使用可以从具有 mu 和 sigma 的高斯分布中采样“a”的东西。我该怎么做?像这样?
def lnprior(theta):
a, b, c = theta
if 1.0 < b < 2.0 and 1.0 < c < 2.0:
return 0.0
if 0<a<20:
mu=10
sigma=1
s=np.random.normal(mu, sigma)
return s
return -np.inf
但这似乎不对?