在运行
with my_second_model:
# 自动指定 NUTS 采样算法,并对后验分布进行 6000 次采样,其中,预烧期为 1000 次,正式采样 5000 次
trace1 = pm.sample(draws=5000, tune=1000)
# 使用 MAP 获得初始值
start = pm.find_MAP(method="BFGS")
# 对于 sigma 指定使用 Slice 采样算法,而其他两个参数 alpha 和 beta 的采样方法由模型自动指定为 NUTS 采样算法
step = pm.Slice(vars=[sigma])
# 对后验分布进行 6000 次采样,其中,预烧期为 1000 次,正式采样 5000 次
trace2 = pm.sample(draws=5000, tune=1000, step=step, start=start)
报错
In v4.0, pm.sample will return an arviz.InferenceData
object instead of a MultiTrace
by default. You can pass return_inferencedata=True or return_inferencedata=False to be safe and silence this warning.
报错提示是警告信息,在4.0版本中使用函数sample时要指定参数return_inferencedata=True 或False,说明一下返回数据类型,这样就可能避免出现警告信息。