Machine learning models · Phase 3 · Lesson 28

Hidden Markov models and Kalman filters

Model sequences with hidden state, noisy observations and transitions over time.

This is one focused step in the 60-lesson course. Use the retrieval check before moving on.

Lesson goal

Model sequences with hidden state, noisy observations and transitions over time.

The core idea

A hidden state evolves over time and emits observations. The model never sees the state directly, so it combines transition and observation evidence.

Mental model

Picture it this way. A hidden state evolves over time and emits observations. The model never sees the state directly, so it combines transition and observation evidence. The important question is what assumption this picture makes, and whether that assumption fits the data.

Mathematical core

An HMM uses discrete states, transition probabilities and emission probabilities. A Kalman filter uses linear Gaussian transitions and performs prediction then measurement update.

Worked example

A sensor may report noisy position while the true position changes smoothly. A Kalman filter estimates the hidden position; an HMM can infer weather states from observed activity.

When to use it

It earns a place when

  • Use them when state and temporal dependence are central and their assumptions are a useful approximation.
  • You can evaluate it against a credible baseline.
  • Its output fits the decision and data constraints.

Do not make it the default when

  • Do not use a standard HMM when observations have long memory or strongly nonlinear dynamics without checking the mismatch.
  • A simpler model has not been tested.
  • The data or target definition is still unclear.

Failure modes

Watch for this. State count and emission assumptions are hard to identify. Filtering can be confused with smoothing if future observations are accidentally used.

When a result looks surprisingly good, inspect the split, target timing, error slices and data-generating process before celebrating.

Practice

Use this as a small experiment rather than a recipe to copy blindly. Change one thing, record the result and explain the change.

Do this. Simulate a two-state HMM or noisy motion process. Compare the raw observations with filtered state estimates and label which information is available at each time.

Retrieval check

Answer from memory first. The buttons reveal feedback, but the durable step is explaining why.

1. What is hidden in a hidden Markov model?

2. What is a Kalman filter's basic rhythm?

3. What is smoothing allowed to use?

Transfer prompt. Describe one real problem where this model or idea would be a sensible candidate. Name the target, the main risk and the metric you would inspect.

Primary source

Probabilistic Machine Learning. Use the source for the deeper treatment after you can explain the lesson's core idea without looking.