CSE-41XX
CS-4101 AI

Lecture 11.1: Probabilistic Reasoning and Bayesian Networks

An in-depth guide to Bayesian reasoning, conditional and joint probability updates, and Bayesian Network inference.

In real-world settings, agents must act under uncertainty. Since classical logic cannot easily handle noisy or incomplete information, we rely on probability theory to model belief.

Bayesian reasoning provides a mathematically rigorous way to update an agent's beliefs (represented as probabilities) when new evidence or observations arrive, moving from initial intuition to disciplined reasoning.


Foundations of Conditional Probability

To understand Bayes' rule, we first build from basic probability concepts.

Mutually Exclusive Events

Two events AA and BB are mutually exclusive if they cannot occur at the same time (e.g., throwing a single die and getting both a 11 and a 66 simultaneously). The probability of either event occurring is the sum of their individual probabilities: P(AB)=P(A)+P(B)P(A \lor B) = P(A) + P(B)

Dependent Events & Joint Probability

When events are not independent, the occurrence of one event alters the likelihood of another. The joint probability P(AB)P(A \land B) represents the probability that both AA and BB occur: P(AB)=P(AB)P(B)=P(BA)P(A)P(A \land B) = P(A | B) P(B) = P(B | A) P(A)

Because joint probability is commutative (P(AB)=P(BA)P(A \land B) = P(B \land A)), we can derive Conditional Probability (the probability of AA occurring given that BB has already occurred): P(AB)=P(AB)P(B)=P(BA)P(A)P(B)P(A | B) = \frac{P(A \land B)}{P(B)} = \frac{P(B | A) P(A)}{P(B)}


Bayes' Theorem (Bayes' Rule)

Named after Reverend Thomas Bayes, this fundamental theorem describes how to update the probability of a hypothesis (HH) based on observing new evidence (EE):

P(HE)=P(EH)×P(H)P(E)P(H | E) = \frac{P(E | H) \times P(H)}{P(E)}

Where:

  • P(HE)P(H | E) (Posterior Probability): The updated probability of hypothesis HH after observing evidence EE.
  • P(EH)P(E | H) (Likelihood): The probability of observing evidence EE given that hypothesis HH is true.
  • P(H)P(H) (Prior Probability): The initial probability of the hypothesis before seeing the evidence.
  • P(E)P(E) (Marginal Likelihood / Evidence): The total probability of the evidence under all possible hypotheses. If we only have two mutually exclusive outcomes (HH and ¬H\neg H), it is calculated as: P(E)=P(EH)P(H)+P(E¬H)P(¬H)P(E) = P(E | H)P(H) + P(E | \neg H)P(\neg H)

Thus, the full expanded form is: P(HE)=P(EH)×P(H)P(EH)P(H)+P(E¬H)P(¬H)P(H | E) = \frac{P(E | H) \times P(H)}{P(E | H)P(H) + P(E | \neg H)P(\neg H)}


Generalizing Bayes' Rule: Multiple Hypotheses & Evidence

In complex diagnostic settings, we often choose among multiple mutually exclusive and exhaustive hypotheses H1,H2,,HmH_1, H_2, \dots, H_m given multiple independent evidences E1,E2,,EnE_1, E_2, \dots, E_n.

Assuming the evidences are conditionally independent given each hypothesis, the generalized posterior probability is:

P(HiE1E2En)=P(E1Hi)×P(E2Hi)××P(EnHi)×P(Hi)k=1m[P(E1Hk)×P(E2Hk)××P(EnHk)×P(Hk)]P(H_i | E_1 E_2 \dots E_n) = \frac{P(E_1|H_i) \times P(E_2|H_i) \times \dots \times P(E_n|H_i) \times P(H_i)}{\sum_{k=1}^m \left[ P(E_1|H_k) \times P(E_2|H_k) \times \dots \times P(E_n|H_k) \times P(H_k) \right]}

Step-by-Step Simulation: Updating Beliefs with Incoming Evidence

Let's walk through a concrete numerical example. Suppose a system has three possible hypotheses (H1,H2,H3H_1, H_2, H_3) and can observe three pieces of evidence (E1,E2,E3E_1, E_2, E_3).

Prior and Conditional Probabilities Table:

ProbabilitiesHypothesis H1H_1Hypothesis H2H_2Hypothesis H3H_3
Prior P(Hi)P(H_i)0.400.400.350.350.250.25
P(E1Hi)P(E_1 \| H_i)0.30.30.80.80.50.5
P(E2Hi)P(E_2 \| H_i)0.90.90.00.00.70.7
P(E3Hi)P(E_3 \| H_i)0.60.60.70.70.90.9

We will observe evidences one by one and update our beliefs dynamically.

Step 1: Observing Evidence E3E_3

When E3E_3 is observed, we compute the updated probability for each hypothesis.

  • Denominator (Marginal Likelihood P(E3)P(E_3)): P(E3)=k=13P(E3Hk)P(Hk)=(0.6×0.40)+(0.7×0.35)+(0.9×0.25)P(E_3) = \sum_{k=1}^3 P(E_3 | H_k) P(H_k) = (0.6 \times 0.40) + (0.7 \times 0.35) + (0.9 \times 0.25) P(E3)=0.240+0.245+0.225=0.710P(E_3) = 0.240 + 0.245 + 0.225 = 0.710

  • Updated Posteriors P(HiE3)P(H_i | E_3):

    • P(H1E3)=0.6×0.400.7100.34P(H_1 | E_3) = \frac{0.6 \times 0.40}{0.710} \approx \mathbf{0.34}
    • P(H2E3)=0.7×0.350.7100.34P(H_2 | E_3) = \frac{0.7 \times 0.35}{0.710} \approx \mathbf{0.34}
    • P(H3E3)=0.9×0.250.7100.32P(H_3 | E_3) = \frac{0.9 \times 0.25}{0.710} \approx \mathbf{0.32}

Belief Shift: After observing E3E_3, the belief in H1H_1 decreases slightly (from 0.400.40 to 0.340.34), while the belief in H3H_3 increases (from 0.250.25 to 0.320.32). H1H_1 and H2H_2 are now tied.

Step 2: Observing Evidence E1E_1 (in addition to E3E_3)

Now we receive E1E_1 and update the beliefs using joint evidence E1E3E_1 E_3:

  • Denominator P(E1E3)P(E_1 E_3): P(E1E3)=k=13P(E1Hk)P(E3Hk)P(Hk)=(0.3×0.6×0.40)+(0.8×0.7×0.35)+(0.5×0.9×0.25)P(E_1 E_3) = \sum_{k=1}^3 P(E_1 | H_k) P(E_3 | H_k) P(H_k) = (0.3 \times 0.6 \times 0.40) + (0.8 \times 0.7 \times 0.35) + (0.5 \times 0.9 \times 0.25) P(E1E3)=0.072+0.196+0.1125=0.3805P(E_1 E_3) = 0.072 + 0.196 + 0.1125 = 0.3805

  • Updated Posteriors P(HiE1E3)P(H_i | E_1 E_3):

    • P(H1E1E3)=0.0720.38050.19P(H_1 | E_1 E_3) = \frac{0.072}{0.3805} \approx \mathbf{0.19}
    • P(H2E1E3)=0.1960.38050.52P(H_2 | E_1 E_3) = \frac{0.196}{0.3805} \approx \mathbf{0.52}
    • P(H3E1E3)=0.11250.38050.29P(H_3 | E_1 E_3) = \frac{0.1125}{0.3805} \approx \mathbf{0.29}

Belief Shift: H2H_2 is now considered the most likely hypothesis by far (0.520.52), and belief in H1H_1 has dropped dramatically down to 0.190.19.

Step 3: Observing Evidence E2E_2 (in addition to E1,E3E_1, E_3)

Finally, we observe E2E_2 and update to E1E2E3E_1 E_2 E_3:

  • Denominator P(E1E2E3)P(E_1 E_2 E_3):

    • Note that P(E2H2)=0.0P(E_2 | H_2) = 0.0. Thus, H2H_2 cannot produce evidence E2E_2. P(E1E2E3)=(0.3×0.9×0.6×0.40)+(0.8×0.0×0.7×0.35)+(0.5×0.7×0.9×0.25)P(E_1 E_2 E_3) = (0.3 \times 0.9 \times 0.6 \times 0.40) + (0.8 \times 0.0 \times 0.7 \times 0.35) + (0.5 \times 0.7 \times 0.9 \times 0.25) P(E1E2E3)=0.0648+0.0+0.07875=0.14355P(E_1 E_2 E_3) = 0.0648 + 0.0 + 0.07875 = 0.14355
  • Updated Posteriors P(HiE1E2E3)P(H_i | E_1 E_2 E_3):

    • P(H1E1E2E3)=0.06480.143550.45P(H_1 | E_1 E_2 E_3) = \frac{0.0648}{0.14355} \approx \mathbf{0.45}
    • P(H2E1E2E3)=0.00.14355=0.0P(H_2 | E_1 E_2 E_3) = \frac{0.0}{0.14355} = \mathbf{0.0}
    • P(H3E1E2E3)=0.078750.143550.55P(H_3 | E_1 E_2 E_3) = \frac{0.07875}{0.14355} \approx \mathbf{0.55}

Belief Shift: Because P(E2H2)=0P(E_2 | H_2) = 0, hypothesis H2H_2 is completely abandoned (P=0P=0). H3H_3 emerges as the most likely hypothesis (0.550.55), followed closely by H1H_1 (0.450.45).


Bayesian Networks

A Bayesian Network is a graphical model that represents probabilistic dependencies among a set of random variables. It consists of:

  1. Structure (DAG): A Directed Acyclic Graph where:
    • Nodes: Represent random variables (discrete or continuous).
    • Edges: Directed arrows pointing from parent to child, representing direct influence or causal dependency. Cycles are forbidden to avoid infinite probability calculation loops.
  2. Parameters (CPTs): Each node has an associated Conditional Probability Table (CPT) that quantifies the effects of its parent nodes. If a node has no parents (root node), its CPT reduces to its prior probability distribution.

Reasoning and Inference in Bayesian Networks

Once the network structure and CPTs are defined, we can perform inference—calculating posterior probabilities of target query variables given some observed variables (evidence).

1. Exact Inference Algorithms

Calculate the exact mathematical posterior distribution:

  • Variable Elimination: Evaluates the joint distribution sum by distributing sums over products, avoiding redundant computations.
  • Junction Tree Algorithm: Transforms the DAG into a tree of cliques (clique tree) and uses belief propagation messaging to calculate exact margins.

2. Approximate Inference Algorithms

For highly complex networks with hundreds of variables, exact inference is NP-hard. We use randomized sampling:

  • Direct Sampling: Generates samples starting from root nodes down using prior distributions.
  • Rejection Sampling: Generates direct samples but discards (rejects) any sample that does not match the observed evidence.
  • Likelihood Weighting: Keeps all samples but weights each one by the likelihood of the observed evidence, avoiding the sample waste of rejection sampling.
  • Markov Chain Monte Carlo (MCMC) & Gibbs Sampling: Generates samples by making state transitions in a Markov chain whose stationary distribution matches the network's joint probability distribution.

3. Deterministic Approximations

  • Mean Field Variational Methods: Formulates inference as an optimization problem, approximating the true posterior with a simpler, factorized distribution.
  • Expectation Propagation: Iteratively updates local approximations of factorized distributions.

Influence Diagrams: Extending Bayes Networks for Decision Making

While Bayesian networks model probabilistic dependencies (diagnosis and prediction), Influence Diagrams extend them to model choice and value. They introduce two new types of nodes:

  1. Decision Nodes (Rectangles): Represent actions or choices that the agent can actively choose to perform.
  2. Utility Nodes (Diamonds): Quantify the desirability, reward, or value associated with different outcomes.

By combining probability, choice, and utility, influence diagrams serve as a complete framework for making optimal decisions under uncertainty.

On this page