3

thanks for your help, I am new about this topic.

I have a dataset composed of a sequence of binary observable variables associated with a label, like this.

trainset = [ [0,0,1,0],[0,0,1,0],[0,0,0,1],...,]
labels = [ 0,1,2,...,]
states = 3 # number of unique labels

I am trying to train an HMM in this way

model = HiddenMarkovModel.from_samples(distribution = MultivariateGaussianDistribution, n_components = states,
                                       X= [trainset],
                                       labels = [labels],
                                       algorithm = 'labeled')

When I ran this model, I get this Exception

Exception ignored in: 'pomegranate.hmm.HiddenMarkovModel._labeled_summarize' KeyError: 3

I figure out that the exception is raised when there are no observations for the state -3-. But , state 3 is in my labels. Can someone help me, please? thanks

i_cook_bit
  • 31
  • 2
  • If there are 3 states I would expect labels 0,1,2. So maybe there are actually 4 states?Also be careful not to mix number and strings for the labels. 1! = '1'. Recommend print(set(labels)) to see the unique values – Jon Nordby Sep 11 '20 at 06:07

0 Answers0