Hidden Markov Model probability of producing a sequence

Suppose that we have two models for a 2-state HMM and both have two output symbols: $$A$$ and $$B$$.

Model 1:

• Transition probabilities: $$a_{11}=0.6$$, $$a_{12}=0.4$$, $$a_{21}=0.0$$, $$𝑎_{22}=1.0$$.
• Output probabilities: $$𝑏_1(𝐴)=0.45$$, $$𝑏_1(𝐵)=0.55$$, $$𝑏_2(𝐴)=0.5$$, $$𝑏_2(𝐵)=0.5$$.
• Initial probabilities: $$𝜋_1=0.4$$, $$𝜋_2=0.6$$.

Model 2:

• Transition probabilities: $$a_{11}=0.2$$, $$a_{12}=0.8$$, $$a_{21}=0.0$$, $$𝑎_{22}=1.0$$.
• Output probabilities: $$𝑏_1(𝐴)=0.2$$, $$𝑏_1(𝐵)=0.8$$, $$𝑏_2(𝐴)=0.6$$, $$𝑏_2(𝐵)=0.4$$.
• Initial probabilities: $$𝜋_1=0.7$$, $$𝜋_2=0.3$$.

Which model is more likely to produce the observation sequence $$\{A, B, A\}$$?

• This seems doable, if a bit tedious. What's your problem?
– Gijs
Apr 23 '19 at 14:41
• I am new to Markov Chains and I want to know how can I produce the probability of the sequence in both the models. Apr 23 '19 at 14:57 Using an old code i had on my computer I get : $$p({A, B, A}|\mathrm{Model} 1) \approx 0.1291,$$ while $$p({A, B, A}|\mathrm{Model} 2) \approx 0.0817.$$