Closed heejaeyunajang closed 5 years ago
Great question! The Datta lab uses PyHSMM (https://github.com/mattjj/pyhsmm/) and, to a lesser extent, PyLDS (https://github.com/mattjj/pylds/) and PySLDS (https://github.com/mattjj/pyslds), all of which were written by Matt Johnson (@mattjj). I've used these libraries extensively in my research and helped extend them in various ways; they're great codebases! SSM aims to provide a simpler interface to building and using state space models like HMM's, LDS's, and SLDS's, and to take advantage of new automatic differentiation libraries, specifically Autograd (https://github.com/HIPS/autograd), for "black box" learning and inference.
Before talking about differences, let me note that the codebases are quite similar. Both allow you to construct and fit a variety of state space models, including hidden Markov models (HMMs), linear dynamical systems (LDS), and switching linear dynamical systems (SLDS). Both take a Bayesian approach, estimating a posterior distribution over latent states. Both are written in an object oriented framework with base classes for the fundamental model objects (transitions, observations, etc.) that can be inherited from and extended as necessary.
The major differences are:
PyHSMM, etc. emphasize "fully" Bayesian models with prior distributions over the model parameters (including nonparametric priors) and algorithms for approximating the posterior distribution over model parameters and latent states. The most fully developed algorithm is block Gibbs sampling. By contrast, SSM focuses on point estimation of model parameters via expectation maximization (EM), and, for SLDS, variational approximations of the posterior distribution of latent states via variational EM.
Extending PyHSMM, etc. often requires special purpose code for performing inference. For example, you may need to write a new Gibbs update or mean field coordinate ascent step. This bespoke code can lead to better performance, but it can be limiting if your goal is to rapidly iterate on modeling ideas. SSM aims for easy extensibility by leaning on automatic differentiation libraries and black box optimization routines by default. A good example of this is the recurrent SLDS: implementing this model in PyHSMM required a significant amount of model-specific code (see https://github.com/slinderman/recurrent-slds), but in SSM it's a trivial extension of the SLDS. And if performance is an issue, SSM still allows you to write model-specific updates.
SSM is designed to handle inputs and data-specific tags (e.g. for supporting different model parameters for trials/subjects/conditions). PyHSMM can support inputs and tags as well, but they aren't part of the standard model.
SSM is built with deep generative models and neural networks in mind, and its optimization routines are the same as those used in training deep generative models. The main limitation right now is that autograd does not support GPU computation; that will hopefully be a non-issue with the recent release of JAX (https://github.com/google/jax).
There are plenty of other subtle differences, but these are the main ones. Still, the takeaway should be that there are more similarities than differences.
Thanks so much for such a detailed answer! :+1: That clarifies a lot!!
How is the HMM model here different from that developed by the Datta lab?