Artificial Intelligence: A Visual Learner's Series
Part 4: Uncertainty
The real world rarely offers certainty. Probability lets an agent reason with partial, noisy information.
Probability as degree of belief
In one line: Probability is a number from 0 to 1 for how strongly you believe something, and it changes as your information changes.
Before the text: on time? ███░░░░░░░ about 30%
"Leaving now" (25 min away, meeting in 15):
After the text: on time? ░░░░░░░░░░ near 0%
Key terms: prior P(A); conditional P(A | B); joint distribution; marginalizing (summing out other variables).
Watch out: P(A | B) is not P(B | A). Most famous people use social media; most social media users aren't famous.
Bayes' rule: from effects back to causes
In one line: Bayes' rule flips a conditional probability so you can reason from what you observe back to its likely cause.
Follow both branches that end in a positive test. The healthy branch is so much bigger that its 5% false alarms swamp the true cases.
Key terms: prior (0.1%), likelihood (99%), posterior (under 2%).
Watch out: Ignoring the base rate is one of the most common reasoning errors, even among experts.
Bayesian networks
In one line: Most variables affect only a few others directly, so a network of small tables can stand in for one enormous table.
Once you know whether the alarm sounded, the earthquake tells you nothing more about whether a neighbor calls.
The full joint is just the five small tables multiplied together.
Watch out: Explaining away. Burglary and earthquake are independent, but once you hear the alarm, learning there was an earthquake makes a burglary less likely.
Answering questions: exact and approximate
In one line: Compute the answer exactly by summing over unknowns, or simulate many possible worlds and count.
| Method | How it works | Trade-off |
|---|---|---|
| Enumeration | Sum over every combination of unknowns | Exact; explodes on large networks |
| Variable elimination | Same sums, reusing partial results | Exact; much faster, still hard in worst case |
| Rejection sampling | Simulate, discard runs that don't match evidence, count | Simple; wastes runs when evidence is rare |
| Likelihood weighting | Fix the evidence, weight each run | Wastes less |
| MCMC (Gibbs sampling) | Wander between possible worlds in proportion to probability | Handles big networks; slower to settle |
Watch out: Halving sampling error takes about four times as many samples.
Reasoning over time
In one line: When the world changes and you see only clues, predict forward each step, then correct with the new clue.
Filtering: today's best guess. Prediction: future days. Smoothing: revising past days with later clues. Viterbi: the single most likely sequence.
Kalman filters do this for continuous quantities like GPS position; particle filters use many weighted samples.
Watch out: With no new clues, predictions blur further with every step.
Self-test
Redraw the frequency tree for a disease affecting 1 in 100 with the same test. What's the answer now?
Draw a Bayesian network for why your car won't start (battery, fuel, starter) and the clues you can check.
Sketch the hidden-and-observed rows for tracking whether a store is busy using parking lot photos.