Different HMMs, same observation probability

This notebook assumes that the definitions in "markov_definitions.nb" have already been loaded. It computes the probability that two specific two-state HMMs will evaluate to the same probability for observation sequences of length T=13.

Define two two-state HMMs

First HMM

a1  =  {{0.9, 0.1}, {0.1, 0.9}};  a1  //  TableForm

b1 = a1;  b1  //  TableForm

π1 = {0.5, 0.5};  π1  //  TableForm

λ1  =  {a1, b1, π1};

Second HMM

a2 = {{0.1, 0.9}, {0.9, 0.1}};  a2  //  TableForm

b2 = b1; π2 = π1;

λ2 = {a2, b2, π2};

Generate HMM diagrams

styles  =  {Red,  Blue};

g1 = 
        DrawHMM[a1, b1, HMMStyle -> Sequential, 
          AngularOffset -> 46 Degree,  BendAngle -> 20  Degree,  
          SelfCircleSize -> 1/7, TextOffset -> 1,  SelfTextOffset -> 1, 
          StateText -> False,  ObservableStyle -> styles,  
          FontSize -> 18];
gh1 = SubstituteValues[g1, a1];

g2 = 
        DrawHMM[a2, b2, HMMStyle -> Sequential, 
          AngularOffset -> 46 Degree,  BendAngle -> 20  Degree,  
          SelfCircleSize -> 1/7, TextOffset -> 1,  SelfTextOffset -> 1, 
          StateText -> False,  ObservableStyle -> styles,  
          FontSize -> 18];
gh2 = SubstituteValues[g2, a2];

Visualize both HMMs

Show[GraphicsArray[{{gh1}, {gh2}}],  
        ImageSize -> 400];

Evaluate over all observation sequences of length 13

Generate list of all possible observation sequences of length 13

obs = 
        Table[IntegerDigits[i, 2, 13] + 1, {i, 0, 2^13 - 1}];

Compute evaluation probabilities

p1 = LogProb[#,  λ1] &  /@  obs;

p2 = LogProb[#, λ2] & /@  obs;

Number of equal observation probabilities

n = Length[Position[Chop[p1 - p2],  0]]

Percentage of all possible observation sequences

n*100/(2^13)  //  N