markovmodel / PyEMMA

🚂 Python API for Emma's Markov Model Algorithms 🚂
http://pyemma.org
GNU Lesser General Public License v3.0
307 stars 118 forks source link

Loglikelihood of observation under an HMM model #1409

Closed bamal closed 5 years ago

bamal commented 5 years ago

Hello PyEmma Developers,

I wanted to verify/suggest if I can compute the loglikelihood under a model given a sample for the model like the score function [here] in the hmmlearn package.

Thanks you !

thempel commented 5 years ago

Hi bamal, Can you elaborate on what exactly you intend to compute? In principle, you have direct access to the HMM emission probabilities and the stationary probabilities and so forth. They are stored in the HMM object. As PyEMMA uses the bhmm package under the hood, further properties can be accessed but are a bit hidden. If you have an HMM object hmm, you might want to look into hmm.hmm. It's an instance of bhmm.DiscreteHMM and contains for example a method hmm.hmm.log_p_obs() which "Returns the element-wise logarithm of the output probabilities for an entire trajectory and all hidden states" (cited from docstring). I'm not sure if this is what you were looking for though.