我无法使用 get_chain() 方法访问从 emcee 生成的值。我的代码提供如下:
import numpy as np
import emcee
def log_prob(x): return -np.sum(x**2)
p0 = np.array(np.random.randn(12, 1))
sampler = emcee.EnsembleSampler(12, 1, log_prob)
sampler.run_mcmc(p0, 1000)
samples = sampler.get_chain()
当我运行它时,我收到消息AttributeError: 'EnsembleSampler' object has no attribute 'get_chain'
,但我不知道为什么。我在网上某处读到 get_chain() 方法仅添加在较新版本的 emcee 中,并且需要从 GitHub 下载。如果这是问题,我将如何从 GitHub 下载它并确保它仍然适用于 Anaconda(我是 Python/GitHub 的新手,我不太熟悉如何完成)?
任何帮助将不胜感激!谢谢!