HMM Python package comparison

At the beginning of my postdoc, I searched for and compared Python packages for fitting hidden Markov models. As this may be useful to other HMM fans, I am sharing the resulting table, which non-comprehensively covers various features of IOHMM and Dynamax.

FeatureDescriptionIOHMMDynamax
GaussianHMMHMM with Gaussian emissions, Gaussian mixture modelUnSupervisedIOHMM with OLS emissions (no covariates)GaussianHMM
LinearModelHMMlinear regression with state-dependent weights, switching linear regressionUnSupervisedIOHMM with OLS emissionsLinearRegressionHMM
LogisticModelHMMlogisitic regression with state-dependent weights, switching logistic regressionUnSupervisedIOHMM with GLM emissions – Bernoulli with logistic link functionLogisticRegressionHMM
MultinomialHMMinclude miss trialsnot possible?MultinomialHMM
Covariates affecting transition probabilityUnSupervisedIOHMM with transition covariatesnot possible
Covariates affecting initial stateUnSupervisedIOHMM with intial state covariatesnot possible?
Stickinessincreased probability of self-transitionsnot possible?stickiness parameter
Mutiple emissionswith different distributions?UnSupervisedIOHMM (inc. with different distributions)not possible?
Multidimensional emissionsUnSupervisedIOHMMany of the above models
Model initialisationrandomkmeans or prior (random sample from prior distribution)
Running timeTime to fit 2-state LinearModelHMM on RTs with contrast as input, 400 trials1.6s (initialisation and em fitting)initialisaton: 0.6s, em fitting: 1.1s
Other prosflexible, easy to add and remove things from the same modelsupport available from active developers, many more functionalities, Bayesian (returns a distribution, priors are explicit)
Other consis it being actively maintained? Seems to be just a couple people working

Have I missed another package or misrepresented something here? Please let me know!

Update 17/04/2025: I am mainly using Dynamax at this point. While IOHMM was reliable for fitting a LinearRegressionHMM, I found that parameter estimates were unstable and suspicious when fitting a GLM-HMM. Using sensible initial parameters in Dynamax solved this problem.

Leave a comment