mattjj / pyhsmm

MIT License
545 stars 172 forks source link

Left-right models support #88

Open bacalfa opened 6 years ago

bacalfa commented 6 years ago

I took a shot at adding support for left-right models in this PR: https://github.com/mattjj/pyhsmm/pull/87. For reference, see https://github.com/hmmlearn/hmmlearn/issues/47. The idea is to fix entries in the transition matrix (and possibly initial state probabilities) initially set to zero to force the behavior of a left-right model.

Comments and suggestions are welcome.

bacalfa commented 6 years ago

A concern I have is that self-transitions are typically not allowed for HSMMs. In order to force that, in the added example file (https://github.com/mattjj/pyhsmm/pull/87/commits/d6e04232989afde6c7c4b059a901f1862bd8b8ff#diff-f9bd8d3dbadac3470ff635210c4035de), the trans_matrix would have to be modified following something like this:

for i in range(Nmax - 1):
     trans_matrix[i, i] = 0.0

The element trans_matrix[-1, -1] can't be zero, otherwise the last row is all zeros.

Any thoughts?