I’m trying to implement logistic regression. The problem circa the same of this tutorial, and the dataset is a modified version of the one named. I do not know how is modified.
Here is the code that I run:
data['ages']=np.square(data['age']) with pm.Model() as logistic_model: pm.glm.GLM.from_formula('income_more_50K ~ age + ages + hours + educ', data, family=pm.glm.families.Binomial()) start=pm.find_MAP() sampler=pm.Metropolis() trace_logistic_model = pm.sample(400, step=sampler, start=start, init='adapt_diag')
The point is: without
ages (i.e. age squared) added to the model, PyMC runs as expected, and I can get the plots of
traceplot. But when I add
ages and call
traceplot, I get completely flat figures, as you can see below.
Given that the original tutorial, with the original dataset, everything works as expected, there should be something in the data that break PyMC3. But I am not able to find it.
Can someone give me an hint?