Setup: COVID HMM from 2022 Q9

Training data (timesteps 1–7): hidden states L, M, H, H, H, M, M; observations +, ++, ++, +++, ++, ++, +.
Estimated parameters — Transition matrix A (MLE, no smoothing):
| qt−1 / qt | L | M | H |
|---|
| L | 0 | 1 | 0 |
| M | 0 | 2/3 | 1/3 |
| H | 0 | 1/3 | 2/3 |
Emission matrix B (MLE, no smoothing):
| qt / ot | + | ++ | +++ |
|---|
| L | 1 | 0 | 0 |
| M | 0 | 1 | 0 |
| H | 0 | 2/3 | 1/3 |
Task
Timesteps 8–10, observations: +++, ++, ++. Unknown state sequence. Start from t=7 in state M. Find the most likely hidden-state path.
Initialisation at t=7
We are in state M at t=7. Set:
δL(7)=0δM(7)=1δH(7)=0
t=8: Observation = +++
| State | Computation | δ | ψ |
|---|
| L | bL(+++)=0⇒δL(8)=0 | 0 | — |
| M | bM(+++)=0⇒δM(8)=0 | 0 | — |
| H | max[δM(7)⋅aM→H⋅bH(+++),δH(7)⋅aH→H⋅bH(+++)] | 91 | M |
δH(8)=1⋅31⋅31=91
Best at t=8: H with δ=91, came from M.
t=9: Observation = ++
| State | Computation | δ | ψ |
|---|
| L | No viable path leads to L | 0 | — |
| H | δH(8)⋅aH→H⋅bH(++) | 814 | H |
| M | δH(8)⋅aH→M⋅bM(++) | 813 | H |
δH(9)=91⋅32⋅32=814
δM(9)=91⋅31⋅1=271=813
Best at t=9: H with δ=814, came from H.
t=10: Observation = ++
| State | Computation | δ | ψ |
|---|
| H | δH(9)⋅aH→H⋅bH(++) | 72916 | H |
| M | δH(9)⋅aH→M⋅bM(++) | 72912 | H |
| L | No viable path leads to L | 0 | — |
δH(10)=814⋅32⋅32=72916
δM(10)=814⋅31⋅1=2434=72912
Best at t=10: H with δ=72916, came from H.
Backtracking
Start from q10∗=H and follow backpointers:
q10∗=H⇒ψH(10)=H⇒q9∗=H
ψH(9)=H⇒q8∗=H
ψH(8)=M⇒q7∗=M
Optimal state sequence (t=7–10): [M,H,H,H]. For t=8,9,10: H, H, H.
Trellis Table (Exam Layout)
| State | t=7 (M) | t=8 (+++) | t=9 (++) | t=10 (++) |
|---|
| L | 0 | 0 | 0 | 0 |
| M | 1 | 0 | 3/81 ←H | 12/729 ←H |
| H | 0 | 1/9 ←M | 4/81 ←H | 16/729 ←H |
Bold = max per column. Arrows show backpointers. Trace backwards from t=10: H → H → H → M.
Key Observations
- Zero emissions (bL(+++)=0, bM(+++)=0) permanently kill those paths at t=8. Without smoothing, dead paths never recover.
- The transition aM→H=1/3 at t=8 gets the path to H, which then becomes the only viable route forward.
- bH(++)=2/3 gives H an edge over M at t=9 and t=10 despite bM(++)=1, because H’s accumulated delta is higher at t=8.
- The optimal path probability is 72916, which is very small — typical for Viterbi with many multiplications. In practice, use log-space to avoid underflow.
Summary
| Timestep | Observation | Best State | δj(t) | Source |
|---|
| 8 | +++ | H | 1/9 | M |
| 9 | ++ | H | 4/81 | H |
| 10 | ++ | H | 16/729 | H |
Past paper questions: y2022p3q9