jmschrei / pomegranate

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

[BUG] #970

Closed malonzm1 closed 2 years ago

malonzm1 commented 2 years ago

I have a very short script,

model = HiddenMarkovModel.from_samples(NormalDistribution, n_components=3, X=sequence)
viterbi_likelihood, viterbi_path = model.viterbi(sequence)

It returns a viterbi_likelihood of -inf and an empty viterbi_path. Could it be because my sequence has many nan's (otherwise the values range from -1 to 1)? Pls. advise.

Thanks and good day.

jmschrei commented 2 years ago

Can you provide the sequence? It's difficult for me to know exactly what's going wrong from this alone. In general, pomegranate does support missing values.

malonzm1 commented 2 years ago

I changed my code so there's less nan in the input sequence. However, all the hidden states in the viterbi path shows just one state.

Here is the sequence. sequence.txt

malonzm1 commented 2 years ago

I used MultivariateGaussianDistribution for the HiddenMarkovModel.from_sample function. The viterbi path now looks better.

malonzm1 commented 2 years ago

I understand that nan's are ignored by the model. But when I look at the viterbi path, nans have hidden states as well.

Btw, does pomegranate have support for replicates of continuous observations?