Pregunta

I'm trying to run a simple logistic regression on PyMC3. Here the code:

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 sampler run, but at the end it gives this error:

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.

Can someone help me in understanding what is wrong, and why the sampler do not converge?

Thank you!

No hay solución correcta

Licenciado bajo: CC-BY-SA con atribución
scroll top