Stanford CS221 | Autumn 2025 | Lecture 12: Bayesian Networks I
Why It Matters
Bayesian networks provide a principled, flexible foundation for reasoning under uncertainty, enabling AI systems to make informed decisions even when data is noisy or incomplete.
Key Takeaways
- •Bayesian networks model world states using probabilistic graphs.
- •Marginalization collapses variables, summing over irrelevant dimensions in practice.
- •Conditioning renormalizes probabilities based on observed evidence for predictions.
- •Joint distribution serves as a "SQL database" for inference queries.
- •Einops tensors enable concise implementation of probability operations.
Summary
In Lecture 12 of Stanford’s CS221, Professor Koller pivots from the model‑free learning methods covered earlier to a model‑based framework, introducing Bayesian networks as a systematic way to represent and reason about uncertain worlds.
He explains that a joint probability distribution over a set of random variables—illustrated with the simple sun (S) and rain (R) example—encodes the truth‑table of all possible world states. Operations such as marginalization collapse irrelevant variables by summing over their values, while conditioning selects assignments consistent with observed evidence and renormalizes the probabilities.
The instructor demonstrates these concepts with a lightweight ProbTable class built on NumPy, using einops to express marginalization and conditioning as one‑line tensor operations. He likens the joint distribution to an SQL database, where probabilistic inference is analogous to issuing queries like “what is the probability of rain given traffic and autumn?”.
Understanding Bayesian networks equips students with model‑based tools that can adapt to changing reward functions, support counterfactual reasoning, and scale to complex domains. For practitioners, the ability to encode domain knowledge as probabilistic graphs and perform efficient inference is crucial for robust AI systems.
Comments
Want to join the conversation?
Loading comments...