jmschrei / pomegranate

Fast, flexible and easy to use probabilistic modelling in Python.
http://pomegranate.readthedocs.org/en/latest/
MIT License
3.29k stars 590 forks source link

[Question] How to retrieve dense transition matrix for a fitted hmm in version 1.0.4 #1086

Closed ko62147 closed 3 months ago

ko62147 commented 3 months ago

Hello,

I am fitting hidden Markov models (HMMs) to data using pomegranate version 1.0.4 and need to extract the dense (state) transition matrices of the HMMs. However, I am unable to find the method that returns the state transition matrix. I know that older versions of pomegranate (0.14.9) have a method for HMMs called dense_transition_matrix() that returns the transition probabilities between states. Is this method available in version 1.0.4 and how do I access it? Thanks for your anticipated reply.

jmschrei commented 3 months ago

self.edges should have the edges for both dense and sparse HMMs. https://github.com/jmschrei/pomegranate/blob/master/pomegranate/hmm/dense_hmm.py#L104

ko62147 commented 3 months ago

Thanks for the reply. I noticed that self.edges only returns the state transition probabilities among distributions/states without the transitions from and to the silent (start and end) states. How would one go about including the start and end state transition probabilities in the matrix?

jmschrei commented 3 months ago

self.starts and self.ends contains the log probabilities.