Markov Processes and Sensor Models
State against evidence, the Markov assumption that bounds the past, the sensor Markov assumption that bounds the present, and the joint distribution the two of them factorise.
Every model so far has described a world that holds still while you reason about it. Now the world changes, and you watch it through a sensor that sometimes lies. The apparatus for that turns out to be the previous path's Bayesian network, unrolled through time and made repetitive on purpose.
State and evidence
Split the variables in two.
- is the state at time : what is actually true, and what you cannot observe.
- is the evidence at time : what your sensors report. The observation is .
Time is sliced into steps of a fixed size, so counts slices rather than seconds. The interval is a modelling choice; the algorithms do not care.
The umbrella world
Russell and Norvig's example is deliberately small. You are a security guard in an underground installation. You want to know whether it is raining today, and your only contact with the outside world is seeing the director arrive each morning with or without an umbrella. So (rain today) is the state, (umbrella today) is the evidence, and the whole problem is inferring a hidden variable from a proxy.
Read those three blocks as a prior, a transition model, and a sensor model. Rain persists: a rainy day is followed by another with probability . The director is a decent but imperfect indicator: he carries an umbrella on of rainy days, and on of dry ones anyway.
Two assumptions
A history has no bounded length, so involves a conditional distribution whose parent set grows without limit. Two assumptions cut it down.
The Markov assumption. The current state depends on the history only through a bounded number of previous states. Taking one, a first-order Markov process:
The sensor Markov assumption. The current reading depends only on the current state:
Both are claims about the state, not about physics or hardware. If yesterday's reading still tells you something about today's once today's state is known, your state variable is missing something.
When the assumption is wrong, enlarge the state. If rain today really does depend on the two previous days, you have two repairs. Raise the order of the model, letting depend on and ; or keep it first-order and enrich the state, adding or so that the extra dependence runs through a variable rather than through time. The second is usually better, because it is a claim about the world rather than a patch.
We also assume the process is stationary: the transition and sensor models are the same at every step. That is what lets two small tables describe a history of any length. Stationary is not the same as static - the world changes, the laws do not.
The joint distribution
With those assumptions the model is an ordinary Bayesian network in which each state's only parent is the previous state and each observation's only parent is its own state. The semantics is the one from the previous path:
Three factors describe a history of any length, which is the whole payoff.
Worked example: the probability of one history
Suppose it rains on both days and the umbrella appears on both. Reading one entry per factor:
Runs in your browser. The first run downloads the Python runtime (~10 MB), then it is cached.
Because every history has a probability, every question about the world has an answer: sum the histories that agree with it. That is correct and hopeless - there are of them. The next lesson is about not enumerating them.
Here is that chain with the entries on it. Every arrow carries the one table entry it contributes, and the product underneath is whichever history you have selected; change a day and watch exactly two entries move. The count beside it is the price of the honest answer, and it doubles each time you add a day. The panel at the bottom states the sensor Markov assumption as four numbers, because it is the one readers over-read: yesterday’s umbrella does tell you something about today’s, and stops telling you anything the moment today’s rain is known.
Interactive: one entry per factor
Click a day to change the weather or the umbrella.
- Probability of this history
- 0.2835
- Histories of this length
- 4
- Probability of these umbrellas
- 0.3515
- This history’s share
- 80.7%
Each arrow contributes exactly one table entry, and the product is 0.2835. Three tables, 2 days, and nothing bigger than a four-entry conditional anywhere. The cost is underneath it: answering any question honestly means adding up all 4 histories of this length, and the count doubles with every day. It is also lopsided - this one history holds 80.7% of the weight the observations allow - so the work is not even spread evenly over what it buys. The next lesson removes the sum entirely. Below, the assumption that makes that possible, as four numbers: yesterday’s umbrella clearly says something about today’s, and says nothing at all once today’s rain is known.
What the sensor Markov assumption actually says
- P(umbrella today)
- 0.550
- given yesterday’s umbrella
- 0.639
- given today’s rain
- 0.900
- given rain and yesterday’s umbrella
- 0.900
The four questions
Everything the rest of this path does falls into four tasks.
- Filtering: , the belief about now given everything so far. This is what a running agent maintains.
- Prediction: for , the belief about a future state.
- Smoothing: for , a better estimate of an earlier state, made with hindsight.
- Most likely explanation: , the single history that best explains the observations.
The first three share one recursion. The fourth, deceptively, does not.
Before the quiz
Be able to separate state from evidence, state both Markov assumptions and say which object each constrains, write the joint as a product of prior, transition and sensor factors, and name the two repairs when the assumption fits badly.
References & further reading
- Stuart Russell, Peter Norvig, Artificial Intelligence: A Modern Approach, Pearson (3rd edition), 2010· Kudos AI reference library
Copyrighted works are cited for reference only and are not hosted here; please consult the publisher for access.
Unlock the full path
This first lesson is free. Enrol to take the mastery quiz, earn XP, and unlock every module, with more interactive, runnable examples throughout.