1

I want to export the trans matrix, and emission matrix from GaussianHMM in hmmlearn, and use those matrices as model parameters in forward algorithm written by c++, it's clear that "transmat_" attribute is the trans matrix,but how to get the emission matrix ? does "means_" attribute of model represent the emission matrix ? thanks !

please refer to hmmtrain method in matlab toolbox, the 2th element returned by hmmtrain is excactly the one i wanted to get from GaussianHMM in hmmlearn:

https://cn.mathworks.com/help/stats/hidden-markov-models-hmm.html#f8288

fla888
  • 67
  • 1
  • 8

2 Answers2

1

This was recently discussed in hmmlearn issue tracker.

In short, the matrix, where the (t, i)-th element is the probability of seeing observation X[t] at state i, can be computed via _compute_log_likelihood.

Sergei Lebedev
  • 2,659
  • 20
  • 23
1

By using the GaussianHMM method, you won't have an emission matrix. The model doesn't map to discrete states.

It maps from discrete hidden states to continuous outputs using by assuming a Gaussian distribution of emissions (hence GaussianHMM). Your emissions are hence described by the means and covariances attributes of the trained HMM.

For an emission matrix like you are describing, you would want to use a MultinomialHMM instead which has discrete outputs.

Adam Kells
  • 111
  • 2
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 13 '21 at 19:46