A full joint probability distribution table over ( n ) boolean random variables requires ( 2^n - 1 ) independent probability values — an exponential storage and computational nightmare for real-world problems with hundreds of variables. Bayesian Networks (also known as Belief Networks or Causal Networks, pioneered by Judea Pearl) solve this by exploiting conditional independence relationships to represent full joint distributions compactly in polynomial space.
A Bayesian Network is a structured probabilistic representation composed of two parts:
The fundamental theorem of Bayesian networks states that the complete joint probability distribution over all variables ( X_1, dots, X_n ) is equal to the product of local conditional distributions:
If each variable has at most ( k ) parents, the entire network requires only ( O(n cdot 2^k) ) numbers, shrinking exponential complexity into compact linear storage!
Consider Pearl's famous burglar alarm scenario:
| Node / Variable | Parents | Conditional Probability Table (CPT) Entries |
|---|---|---|
| Burglary (( B )) | None (Root) | ( P(B = ext{True}) = 0.001 ) |
| Earthquake (( E )) | None (Root) | ( P(E = ext{True}) = 0.002 ) |
| Alarm (( A )) | ( B, E ) |
( P(A | B, E) = 0.95 ) ( P(A | B, eg E) = 0.94 ) ( P(A | eg B, E) = 0.29 ) ( P(A | eg B, eg E) = 0.001 ) |
| JohnCalls (( J )) | ( A ) | ( P(J | A) = 0.90 ), ( P(J | eg A) = 0.05 ) |
| MaryCalls (( M )) | ( A ) | ( P(M | A) = 0.70 ), ( P(M | eg A) = 0.01 ) |
Calculating a Joint Probability: What is the probability that both John and Mary call, the alarm went off, but there was neither burglary nor earthquake?
D-Separation is a formal graph-theoretic criterion determining whether a set of variables ( X ) is conditionally independent of another set ( Y ) given observed evidence ( Z ). A path between ( X ) and ( Y ) is blocked if it contains:
In a Bayesian network, a node ( X ) is conditionally independent of all other nodes in the entire network, given its Markov Blanket. The Markov Blanket of node ( X ) consists of:
The following script evaluates exact joint probabilities using Pearl's Alarm network parameters:
def compute_joint_prob(burglary, earthquake, alarm, john, mary):
# CPT Definitions
p_b = 0.001 if burglary else 0.999
p_e = 0.002 if earthquake else 0.998
# Alarm CPT lookup
alarm_table = {
(True, True): 0.95,
(True, False): 0.94,
(False, True): 0.29,
(False, False): 0.001
}
prob_a_true = alarm_table[(burglary, earthquake)]
p_a = prob_a_true if alarm else (1.0 - prob_a_true)
# JohnCalls CPT
p_j = (0.90 if alarm else 0.05) if john else (0.10 if alarm else 0.95)
# MaryCalls CPT
p_m = (0.70 if alarm else 0.01) if mary else (0.30 if alarm else 0.99)
# Master Chain Factorization Product
joint_probability = p_b * p_e * p_a * p_j * p_m
return joint_probability
# Case 1: Alarm triggers without burglary or earthquake, both neighbors call
prob_false_alarm = compute_joint_prob(False, False, True, True, True)
print(f"P(J, M, A, ~B, ~E) = {prob_false_alarm:.8f}")
# Case 2: Real Burglary occurs, alarm fires, both call
prob_true_burglary = compute_joint_prob(True, False, True, True, True)
print(f"P(J, M, A, B, ~E) = {prob_true_burglary:.8f}")
Broaden your foundational and advanced AI knowledge across our curriculum:
Conditional probability, prior, likelihood, and posterior distributions.
Transition from Bayesian probabilistic graphs to statistical learning.
Measuring classification performance and probabilistic calibration.
Exam questions on D-separation, Markov blanket, and joint probability.