fla888
fla888

Reputation: 67

how to get emission matrix from GaussianHMM model in hmmlearn?

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

Upvotes: 1

Views: 1743

Answers (2)

Adam Kells
Adam Kells

Reputation: 121

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.

Upvotes: 2

Sergei Lebedev
Sergei Lebedev

Reputation: 2679

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.

Upvotes: 1

Related Questions