For training a HMM model, I need start probabilities (pi), the transition probabilities, and emission probabilities. Now I want to train a HMM model with 3 states (1,2,3) and 4 outputs (a,b,c, d). The training data is:
[[abcdabcdabcdabcdabcdbacbacd,abababcdcdcdcdababab,badcacdabacdbbacd,dacdbacdbbccaaadacdbabd,cababcacdbacacdbdacdacdbacdbab,acddbaacbdcaabdcbabd,cdbadcbacdbbdacdbcdaaabd,bcadabbacbacdbdacddb]]
I am trying to use pomegranate to do that, but in the example all of the states have probabilities specified like this:
rainy = State( DiscreteDistribution({
'walk': 0.1, 'shop': 0.4, 'clean': 0.5 }),
name='Rainy' )
sunny = State( DiscreteDistribution({
'walk': 0.6, 'shop': 0.3, 'clean': 0.1 }),
name='Sunny' )`
My problem is how to get the probabilities. I am trying to use pomegranate method model.add_transition()
, but I don't know which parameter I should give? Is there any example that can teach me how to get the probability in my data?