Interactive demo · Probabilistic Machine Learning: Advanced Topics · Chapter 9

Forwards-backwards and Viterbi in the dishonest casino

A casino switches between a fair die and a die loaded towards six. You see only the rolls. The filtered curve (gold) is the probability of the loaded die given the rolls so far (forwards algorithm); the smoothed curve (teal) uses all the rolls (forwards-backwards); the Viterbi panel shows the single most probable state sequence. Grey bars are the true loaded periods. The rolls were generated by the default casino; you change what the model believes.

Model (what the HMM believes)

Rolls

Posterior samples

Try these

The die is loaded towards six, so a run of sixes raises the filtered curve at once; the smoothed curve also looks ahead, so it rises before a streak is complete and stays up after it ends. Viterbi commits to one sequence and can differ from the per-roll best guess of the smoothed curve. Formulas (9.5)–(9.8), (9.12), (9.43)–(9.45), (9.48).

In the lecture notes