bayespy / bayespy

Bayesian Python: Bayesian inference tools for Python
bayespy.org
MIT License
686 stars 164 forks source link

Does bayespy support Factorial HMM? #7

Open hitalex opened 9 years ago

hitalex commented 9 years ago

Does bayespy suport DBN(Dynamic Bayesian Network), like Factorial HMM?

jluttine commented 9 years ago

Hi, I'm on holidays currently. I'll get back to you next week.

jluttine commented 9 years ago

BayesPy supports dynamic networks, but the built-in nodes cover only a few basic dynamic structures. In some cases, complex models can be constructed from simple built-in nodes, but in some cases one may need to implement a specific node for some part of the model. Typically, most parts of models can be constructed with the built-in nodes.

The dynamic built-in nodes include CategoricalMarkovChain, GaussianMarkovChain, SwitchingGaussianMarkovChain and VaryingGaussianMarkovChain.

CategoricalMarkovChain is a discrete Markov chain, basically a hidden Markov model. One can then add some emission distribution by using Mixture node. See http://www.bayespy.org/examples/hmm.html for an example.

GaussianMarkovChain can be used to construct linear state-space models. It defines a Gaussian random variable with Markovian dynamics. By using SwitchingGMC or VaryingGMC, some specific structure can be used efficiently, although identical structures are available by using simpler nodes, but the computations are not as efficient for large datasets. That is, sometimes one needs to implement specific nodes in order to obtain more efficient inference. An example of a linear state-space model: http://www.bayespy.org/examples/lssm.html

About Factorial HMM, there was a question about it earlier (https://github.com/bayespy/bayespy/issues/4) and you may find some information there. I'm not sure what kind of model you have in mind exactly. In some cases, an FHMM can be represented equivalently as an HMM, but the inference isn't as efficient because the structure isn't utilized. For instance, an FHMM with a set of M HMMs and K possible states in each chain can be represented by an HMM with K^M possible states. However, if parameters are unknown or if efficient inference is required, one may need to implement a specific node to handle part of the mixing of several chains. If this is something you need, I could take a look on it in the near future, but for the two-three few weeks I'm busy with other high priority matters.