Hidden Markov Model using PyMC4

Hi Juan!

You can directly add code to your posts by surrounding it with triple backticks (```). This is a lot easier for us to discuss than attaching a script.

Tensorflow isn’t used with PyMC; despite some conversation about it as a possibility, it has never been used. The computational backend is pytensor, which you should be using.

Otherwise, I think it would be good if you could cut this code down to a minimum example that reproduces your error. There’s a lot of support code mixed in with the model code, so it’s not clear to me where I need to help you debug.

I can’t speak to @ericmjl 's specific approach, but we’ve been discussing HMMs quite a bit lately in the context of automatic marginalization and the new(ish) DiscreteMarkovChain distribution. See here for an example, or search the discourse for recent discussion on HMMs.