1

In the backward algorithm for inference in hidden markov models, how would we calculate $\beta$ in matrix form? In the answer to this question, I saw how to calculate $\alpha$ in matrix form, and now I'm interested to see it for $\beta$

1 Answers1

1

Using the same notation as in my answer to your other question: \begin{align} a_{ij}&=p\big(h_{t+1}=j\,\big|\,h_t=i\big)\\ b_{jv}&=p\big(v_t=v\,\big|\,h_t=j\big)\ , \end{align} where $\ h_t\ $ is the hidden state at time $\ t\ $ and $\ v_t\ $ the observed output at time $\ t\ $, $\ C(v)\ $ is the $\ 3\times3\ $ matrix whose entry in row $\ i\ $ and column $\ j\ $ is $\ a_{ij}b_{jv}\ $, and $\ \mathbb{1}\ $ the $\ 3\times1\ $ column vector all of whose entries are $\ 1$.

If the outputs of the hidden Markov model are $\ u_1,u_2 \dots, u_T\ $ then \begin{align} \beta_t(i) &=p\big(v_{t+1}=u_{t+1}, v_{t+2}=u_{t+2},\dots,v_T=u_T\,\big|\,h_t=i\,\big)\\ &=\sum_{j_{t+1}} \sum_{j_{t+2}}\dots\sum_{j_T} a_{ij_{t+1}}b_{j_{t+1}u_{t+1}} a_{j_{t+1}j_{t+2}}b_{j_{t+2}u_{t+2}}\dots a_{j_{T-1}j_T}b_{j_Tu_T}\\ &=\epsilon_i^TC\big(u_{t+1}\big) C\big(u_{t+2}\big)\dots C\big(u_T\big)\mathbb{1}\ , \end{align} where $\ \epsilon_i\ $ is the $\ 3\times1\ $ column vector whose $\ i^\text{th}\ $ entry is $\ 1\ $ and all of whose other entries are $\ 0\ $. If we let $\ \beta_t\ $ be the $\ 3\times1\ $ column vector whose $\ i^\text{th}\ $ entry is $\ \beta_t(i)\ $, then $$ \beta_t= C\big(u_{t+1}\big) C\big(u_{t+2}\big)\dots C\big(u_T\big)\mathbb{1}\ , $$ and the $\beta$-recursion can be written as \begin{align} \beta_T&=\mathbb{1}\\ \beta_t&=C\big(u_{t+1}\big)\beta_{t+1}\ . \end{align}