This posterior can be computed in real-time up through the \(k\) th
observation (a task which is called “filtering”
[1]}) using a recursive
procedure that proceeds as follows. Let \(C^{k}_{AB}\)  be the number of \(A \rightarrow B\) 
transitions up to the \(k\) th observation, and let \(b^{k}_{\pi _{AB}}\)  be the
posterior up to the \(k\) th observation. The base case of the procedure
is the first observation, which is the switch from \(X_0\rightarrow X_1\)  (where \(k = 1\) ):
\(b^{1}_{\pi _{AB}} &= P(\pi _{AB}\mid \left<X_1, X_0\right>) \\&\propto \mathrm {Bin}(C^{k}_{AB}; \pi _{AB}, k)\mathrm {Beta}(\pi _{AB}; \alpha _0,\alpha _1)\\&= \mathrm {Beta}(\pi _{AB}; C^{k}_{AB} + \alpha _0, s - C_{AB} + \alpha _1)\) 
