Step-by-step hidden Markov chain log-likelihood calculation



I have a HMC for which the transition and observation matrices are time varying (and have some 0 elements).

I would like to calculate the log-likelihood (for Bayesian inference). Which library should I use? I looked at a few of them, but they seemed to have a high-level interface for constant matrices, and I need the low-level building blocks for updating, because of the time variation.

I need a numerically stable implementation, I can always program the algorithm from Rabiner’s tutorial, but would prefer not to do it if it has been done. Playing well with AutoDiff.jl would be a bonus (for NUTS/Hamiltonian MC).


Not sure about AutoDiff.jl, but our code follows the conventions of Distributions.jl and will work with ForwarDiff.jl:


something weird is going on with the logz member. you don’t set it in the constructor, but you use it later. maybe simply missing from new?


Thanks for that. Fixed now.