Probabilistic Belief and Bayes Filtering
When I first tried writing localization code, I kept wanting a single clean (x, y) variable for where the robot was. Every time a noisy sensor disagreed with the wheels, I didn't know which number to trust. Switching from tracking a single point to tracking a cloud of probability — a belief — is the moment state estimation finally clicks.
Core ideas covered in this module
- Belief distributions over state
- Predict step (motion uncertainty)
- Update step (measurement Bayes rule)
Thinking in clouds instead of points
Imagine losing your keys somewhere in a dim hallway. You don't actually know their exact coordinate, so your brain carries a mental heat map: high probability near the coat rack, a decent chance by the kitchen counter, almost zero in the bathtub.
In robotics, that heat map over possible poses is called the belief distribution, written bel(x_t). Instead of pretending we know our exact pose, we keep both our best guess (the peak) and how uncertain we are (how wide the blob is).
The two-beat rhythm of Bayes filtering
Every probabilistic filter — from simple 1D grids to full 3D SLAM — repeats the same two-step dance over and over:
- Predict (motion update): the robot drives forward using noisy wheel commands. Because motion adds fresh uncertainty (slip, bumps, gyro noise), the belief distribution shifts forward and spreads out wider.
- Update (measurement Bayes rule): a sensor spots a known landmark or wall. We multiply our spread-out prediction by the sensor's likelihood — shrinking the belief back down around the poses that agree with both.
Interactive lab
2D Extended Kalman Filter Uncertainty Ellipse Visualizer
marimo· LiveKalman Gain K (3×2) & 2σ Spread
Why confidence calibration matters
Notice what happens if you turn on Landmark dropout and keep clicking Predict: without external measurements to anchor it, your uncertainty keeps growing without bound. That isn't a bug — it's an honest report from the math telling you the robot no longer knows where it is.
A robot that knows it is uncertain can slow down, spin its camera around to look for a marker, or ask for help. A robot that tracks only a single point estimate will confidently drive straight into a table leg.
The recursive Bayes filter loop
bel̄(x_t) = ∫ p(x_t | u_t, x_{t-1}) bel(x_{t-1}) dx_{t-1} → bel(x_t) = η · p(z_t | x_t) · bel̄(x_t)
Predict smears the prior belief forward through the noisy motion model; Update multiplies by the measurement likelihood and renormalizes.
A robot sits completely still for 10 seconds with only its wheel odometry running (Predict) and no camera/LiDAR sightings (no Update). What should happen to its belief?
Modern robot policies increasingly output distributions or uncertainty estimates alongside actions, borrowing the exact same idea: knowing when a perception estimate is fuzzy lets a planner stay cautious near obstacles.
Hands-On Python Notebook
02 · Discrete 1D & 2D Bayes Filter Belief Lab
Implement a cyclic hallway histogram Bayes filter alternating motion shift/blur (Predict) with door-sensor likelihood updates.
Try this on your own inside the notebook
- Run 10 predict-only steps without measurements and watch entropy grow
- Track how many door sightings are needed to resolve hallway symmetry
In Google Colab, use File → Save a copy in Drive to keep your own edits and notes. Or download the files directly:
uvx marimo edit --sandbox notebooks/course-5/02_probabilistic_belief_bayes_filter.pyWrap up this module
Saved automatically in your browser profile so you can pick up right where you left off.