# 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'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 . – 5DollarBurger Jun 16 at 1:51