essays-on-data-science
essays-on-data-science copied to clipboard
Chain 0 failed.
Dear Eric,
thanks a lot for a great post HMM in pymc3 (https://ericmjl.github.io/essays-on-data-science/machine-learning/markov-models/). I am writing a thesis in associative learning and I would like to integrate part of your model into my simulations. The problem is that when I run the sampler for
n_states = 3 with pm.Model() as model: p_transition = pm.Dirichlet( "p_transition", a=tt.ones((n_states, n_states)) * 4, # weakly informative prior shape=(n_states, n_states))
# Solve for the equilibrium state
p_equilibrium = solve_equilibrium(n_states, p_transition)
obs_states = HMMStates(
"states",
p_transition=p_transition,
p_equilibrium=p_equilibrium,
n_states=n_states,
observed=np.array(states).astype("float")
)
it gets stack saying "Chain 0 failed."
If I run prior checks I manage to get samples for the "p_transition" but for "states", I get the following error: 'HMMStates' object has no attribute 'p' I guess the problems are related.
Those are the versions: numpy == 1.19.1 theano == 1.0.4 pymc3 == 3.9.3
Thanks a lot in advance for your help.
Vincenzo
Hi @vidigen! Thanks for chiming in. I should update the essay in there with a link to my Bayesian analysis recipes: https://github.com/ericmjl/bayesian-analysis-recipes/blob/master/docs/notebooks/markov-models.ipynb
That one should execute from top to bottom with no Python class definition issues.
There's some things that need improvement, btw, such as the log-likelihood calculation being marginalized over every possible state (something that isn't done in the code). I've been working on that with an intern at work, and we'll be releasing it sometime near the end of the year once he's done with his internship.
Thanks a lot, I will be looking forward to the updates!