Question about HMM

115 Views Asked by At

I have this HMM model that I need to solve. Unfortunately, my textbook isn't the best and only describes general cases which I have difficulty working with.

Consider an HMM with two states: s1 and s2. The transition model is: $P(s_1|s_1) = 0.5$, $P(s_1|s_2) = 0.25$. There are two observations: $P(a|s_1) = 0.25$ and $P(a|s_2) = 0.5$. The initial state is $s_1$ at time $0$.

How would I find the predicted distribution over these two states at time $2$?

1

There are 1 best solutions below

6
On BEST ANSWER

Assume discrete time $t \in \{0, 1, 2, \ldots\}$. Let $Z(t)$ be the value of your Markov chain, so $Z(t) \in \{s_1, s_2\}$. Let $R(t)$ be the observation on slot $t$ (assume $R(t) \in \{a,b\}$). Assume that $Pr[R(t)=a|Z(t)=s_1] = 0.25$, $Pr[R(t)=a|Z(t)=s_2]=0.5$. Let $H(t)$ be the history of observations up to time $t$: $$ H(t) = [R(0), R(1), \ldots, R(t)] $$

Define:

\begin{align} P_1(t) &= Pr[Z(t)=s_1 | H(t)] \\ P_2(t) &= Pr[Z(t)=s_2 | H(t)] \end{align} Note that $P_1(t) + P_2(t) = 1$ for all $t$, and $P_1(0) = 1, P_2(0)=0$.

You want a recursive way to update $P_1(t+1)$ given $P_1(t)$ and given the new observation $R(t+1)$. You can use Baye’s rule. Suppose for example that $R(t+1)=a$. We get:

\begin{align} P_1(t+1) &= Pr[Z(t+1)=s_1 | R(t+1)=a, H(t)] \\ &= \frac{Pr[R(t+1)=a|Z(t+1)=s_1, H(t)]Pr[Z(t+1)=s_1|H(t)]}{Pr[R(t+1)=a|H(t)]} \\ &= \frac{0.25Pr[Z(t+1)=s_1|H(t)]}{Pr[R(t+1)=a|H(t)]} \end{align}

where: \begin{align} Pr[Z(t+1) = s_1|H(t)] &= 0.5P_1(t) + 0.25P_2(t) \\ Pr[Z(t+1) = s_2|H(t)] &= 0.5P_1(t) + 0.75P_2(t) \end{align} and: $$ Pr[R(t+1)=a|H(t)] = Pr[Z(t+1)=s_1|H(t)]0.25 + Pr[Z(t+1)=s_2|H(t)]0.5$$


So if you are given that $R(1)=a$ then you update: \begin{align} Pr[Z(1)=s_1|H(0)] &= (0.5)(1) + 0 = 0.5\\ Pr[Z(1)=s_2|H(0)] &= 0.5\\ Pr[R(1)=a|H(0)] &= (0.5)(0.25) + (0.5)(0.5) = 0.3750\\ P_1(1) &= \frac{(0.25)(0.5)}{0.3750} = 1/3\\ P_2(1) &= 2/3 \end{align}

If you are next given that $R(2)=b$ then you do a similar update to find: \begin{align} Pr[Z(2)=s_1|H(1)] &= ??\\ Pr[Z(2)=s_2|H(1)] &= ??\\ Pr[R(2)=b|H(1)] &= ??\\ P_1(2) &= ??\\ P_2(2) &= ?? \end{align}