我正在尝试在 PyMC3 上运行一个简单的逻辑回归。这里的代码:
with pm.Model() as logistic_model:
alpha=pm.Normal('alpha', mu=0, sd=100)
beta1=pm.Normal('beta', mu=0, sd=100)
beta2=pm.Normal('beta2', mu=0, sd=100)
argtemp=alpha + beta1*data['age'].values +beta2*data['educ'].values
prob=pm.invlogit(argtemp)
Y_obs = pm.Bernoulli('Y_obs', p=prob, observed=data['income_more_50K'].values)
map_estimate = pm.find_MAP()
sampler=pm.Metropolis()
trace= pm.sample(40000, step=sampler, start=map_estimate)
采样器运行,但最后它给出了这个错误:
The gelman-rubin statistic is larger than 1.4 for some parameters. The sampler did not converge.
The estimated number of effective samples is smaller than 200 for some parameters.
有人可以帮助我理解什么是错的,为什么采样器不收敛?
谢谢!