Alicia
Alicia

Reputation: 87

how to build a hmm model with strings as the observation sequence?

I have checked lots of examples and found out for python hmmlearn library, the sequence to be put into model.fit() must be a list of numbers, if I have a string list as the input, i need to convert it into a number list first.

However, if I have two states, 8 observation letters with two groups: vowel and consonant shown as below,

my model result should give me 8*2 emission matrix(8 => 8 letters; 2 => vowel and consonant states)

What should I put in the model.fit()?? How should I build the general hmm model? Any one have any idea??

states=["vowel","consonant"]
obs=["a","b","c","d","e","f","g","h"]

Upvotes: 0

Views: 187

Answers (1)

Alicia
Alicia

Reputation: 87

Well, the answer is easy, just to convert observation sequences to numbers will do, i failed to get result just due to the unknown reason of my Jupyter notebook enovironment, not the code itself!

Upvotes: 0

Related Questions