Hi!
I am trying to compute the likelihood of a hidden markov model (HMM) marginalizing over the hidden states and, in order to do that, I am following the example in How to wrap a JAX function for use in PyMC. However, I cannot convert random variables to a tensor variable using aesara
.
I was able to compute the marginal HMM likelihood using JAX, but I cannot run the PyMC model that is presented in the notebook. Here is the model:
with pm.Model() as model:
emission_signal = pm.Normal("emission_signal", 0, 1)
emission_noise = pm.HalfNormal("emission_noise", 1)
p_initial_state = pm.Dirichlet("p_initial_state", np.ones(3))
logp_initial_state = at.log(p_initial_state)
p_transition = pm.Dirichlet("p_transition", np.ones(3), size=3)
logp_transition = at.log(p_transition)
loglike = pm.Potential(
"hmm_loglike",
hmm_logp_op(
emission_observed,
emission_signal,
emission_noise,
logp_initial_state,
logp_transition,
),
)
When I run this model, I get the following error:
NotImplementedError: Cannot convert p_initial_state ~ Dirichlet to a tensor variable.
A similar question was asked in this post and the proposed solution was to use theano
instead of aesara
, but I think that it is not a solution for my problem.
Is the problem related to the versions of python, aesara and PyMC?
Here are the versions that I am using:
- Python: 3.9.12
- pymc3: 3.11.4
- aesara: 2.6.6