Terminal State Classification with Hidden Markov Models

The Viterbi algorithm predicts the most likely sequence of hidden states. But what if the variable of interest is the final hidden state? For example, predicting if a friend (whom you can't visit due to Covid) is currently ill or healthy using emission observations from a series of daily phone calls.

We can generate marginal hidden state distributions $$p(z_T)$$ at time T by running Monte Carlo simulations on the HMM structure, but I'm wondering is it possible to obtain this distribution given a set of observations $$p(z_T|x_1, x_2, ..., x_T)$$?

$$p(z_T|x_1, x_2, ..., x_T) = \frac{p(x_1, x_2, ..., x_T|z_T) . p(z_T)}{p(x_1, x_2, ..., x_T)}$$

If we apply Bayes’s formula as above, does it make sense to derive $$p(x_1, x_2, ..., x_T|z_T)$$ from the Backward algorithm?

Estimating $$p\left(z_T \mid x_{1\ldots T}\right)$$ is called filtering, and it’s a fundamental operation on HMMs. Filtering is estimation of the current state, given all observations up to this point. (Contrast it with smoothing: estimating a state based on past and future observations.)

You’d want to perform filtering with the forward algorithm, not the backward algorithm. Unlike the Monte Carlo approach, this gives an exact solution in polynomial time.

• You're right. I was confused at first because the forward algorithm directly evaluates $p(z_T, x_{1...T})$, but $p(z_T | x_{1...T})$ can be obtained by simply normalising it to sum to 1 according to Bayes's Formula . Commented Jun 16, 2021 at 1:51
• Even easier: according to the law of total probability. Commented Jun 16, 2021 at 4:04