Skip to content

CS188 Bayes Nets and Ghostbusters: Inference When Ghosts Are Invisible

Aug 22, 2026 1 min
TL;DR Lectures 13–18 and Project 4 move from factor operations and variable elimination to exact inference and particle filtering, letting Pacman track invisible ghosts through noisy distance sensors.
Table of Contents
  1. Factor operations are not mechanical tables
  2. Observation and time are different updates
  3. Study order
  4. References

🌏 中文版

Lectures 13–18 progress from probability and Bayes nets through exact inference and sampling to HMMs and particle filtering. Project 4: Ghostbusters makes the sequence concrete: Pacman cannot see ghosts and receives only noisy Manhattan-distance readings, so it must maintain location beliefs and pursue targets.

Factor operations are not mechanical tables

Joining factors combines compatible information; elimination sums over a variable no longer needed. Variable-elimination cost depends strongly on order. Before each implementation step, state what distribution the factor represents and check conditioned versus unconditioned variables instead of manipulating dictionary keys blindly.

Observation and time are different updates

On a sensor reading, reweight beliefs by likelihood and normalize. When time advances without direct observation, propagate the distribution through the ghost movement model. Alternating these operations is filtering. The official P4 specification states that if every particle receives zero weight, the particle filter must reinitialize rather than sample from an empty distribution.

The official visualization displays posterior probability through brightness. After each update, predict which cells should brighten and where the transition model should move mass, then run the autograder. Predicting the direction of the picture demonstrates more than a passing test.

Study order

Hand-calculate a join and elimination on a two-variable factor, then implement exact inference. Verify normalization before moving to particle filtering. Finally let the greedy BustersAgent act on each ghost's most likely position and examine what is lost when a complete uncertainty distribution is reduced to a mode.

Series navigation: Previous: MDPs and reinforcement learning | Next: Decisions and machine learning

References