Artificial Intelligence - Bayesian Networks and Probability Basics

Course Overview & Schedule

  • Course Name: COSE361 Artificial Intelligence
  • Primary Module: Bayesian Networks & Probabilistic Reasoning
WeekDayContentNote
1-1September 2 (Wed)Introduction
1-2September 7 (Mon)Search
2-1September 9 (Wed)Games
2-2September 14 (Mon)Bayesian Networks
3-1September 16 (Wed)Bayesian Networks, HW1
3-2September 21 (Mon)Tutorial 1
4-1September 23 (Wed)Mid-term exam
4-2September 28 (Mon)Hidden Markov Models
5-1September 30 (Wed)Markov Decision Processes
5-2October 5 (Mon)No ClassHoliday
6-1October 7 (Wed)Machine Learning
6-2October 12 (Mon)Deep Learning Basics, HW2
7-1October 14 (Wed)Tutorial 2
7-2October 19 (Mon)Final exam
--October 20 ~No classes
8-1December 14 (Mon)Optional project presentationTentative, Extra points
8-2December 16 (Wed)Optional project presentationTentative, Extra points

Uncertainty and Utility

  • Nature of the Real World:

    • Real-world environments are inherently uncertain.
    • Example scenario: Leaving for Incheon International Airport (ICN) 60 minutes60\,\text{minutes} before a flight.
  • Sources of Uncertainty:

    • Partial Observability: Incomplete knowledge about external states (e.g., road conditions, other drivers' decisions).
    • Noisy Sensors: Unreliable inputs (e.g., traffic radio reports, GPS routing estimates).
    • Immense Complexity: Extreme difficulty in modeling complex systems fully (e.g., traffic jams, airport security lines).
    • Ignorance of World Dynamics: Unpredictable physical events (e.g., flat tire, vehicle accidents).
  • Role of Probabilistic Assertions:

    • Probabilistic assertions summarize the combined effects of ignorance (incomplete knowledge) and laziness (inability or unwillingness to compute exact states).
  • Decision Making Under Uncertainty:

    • Rational decision-making combines probability and utility theory.
    • Maximum Expected Utility (MEU) Principle: An optimal agent chooses an action a∗a^* that maximizes its expected utility across all possible states ss:

a∗=arg⁡max⁡a∑sP(s∣a)U(s)a^* = \arg\max_a \sum_s P(s \mid a) U(s)

Discrete Probability Fundamentals

  • Outcome Space (Sample Space):

    • Defined as a set Ω\Omega containing all possible world outcomes ω\omega.
    • Example: Rolling a single standard six-sided die gives Ω={1,2,3,4,5,6}\Omega = \{1, 2, 3, 4, 5, 6\}.
  • Probability Model:

    • Assigns a numeric probability P(ω)P(\omega) to every individual outcome ω∈Ω\omega \in \Omega.
    • For a fair die: P(1)=P(2)=P(3)=P(4)=P(5)=P(6)=16P(1) = P(2) = P(3) = P(4) = P(5) = P(6) = \frac{1}{6}.
  • Probability Axioms / Constraints:

    1. Non-negativity: 0≤P(ω)0 \le P(\omega) for all ω∈Ω\omega \in \Omega
    2. Normalization: ∑ω∈ΩP(ω)=1\sum_{\omega \in \Omega} P(\omega) = 1
  • Events:

    • An event AA is any subset of outcomes: A⊆ΩA \subseteq \Omega
    • The probability of event AA is the sum of probabilities of its constituent outcomes:

P(A)=∑ω∈AP(ω)P(A) = \sum_{\omega \in A} P(\omega)

  • Examples:
    • Event "roll <4< 4": A={1,2,3}  ⟹  P(roll<4)=P(1)+P(2)+P(3)=16+16+16=12A = \{1, 2, 3\} \implies P(\text{roll} < 4) = P(1) + P(2) + P(3) = \frac{1}{6} + \frac{1}{6} + \frac{1}{6} = \frac{1}{2}
    • Event "roll is odd": A={1,3,5}  ⟹  P(roll is odd)=P(1)+P(3)+P(5)=16+16+16=12A = \{1, 3, 5\} \implies P(\text{roll is odd}) = P(1) + P(3) + P(5) = \frac{1}{6} + \frac{1}{6} + \frac{1}{6} = \frac{1}{2}

Random Variables

  • Definition:

    • A random variable XX represents a specific feature or aspect of the world whose value is uncertain.
    • Formally, a random variable is a deterministic function mapping an outcome ω∈Ω\omega \in \Omega to a specific domain value.
    • Denoted using uppercase letters (e.g., X,T,D,W,GX, T, D, W, G).
  • Domains / Ranges of Random Variables:

    • Boolean / Discrete Domain:
    • Odd∈{true,false}\text{Odd} \in \{\text{true}, \text{false}\} where Odd(1)=true\text{Odd}(1) = \text{true}, Odd(6)=false\text{Odd}(6) = \text{false}
    • T∈{hot,cold}T \in \{\text{hot}, \text{cold}\}
    • Continuous Domain:
    • D∈[0,∞)D \in [0, \infty) (e.g., time to travel to the airport)
    • Spatial / Coordinate Domain:
    • LGhost∈{(0,0),(0,1),(1,0),… }L_{\text{Ghost}} \in \{(0,0), (0,1), (1,0), \dots\}
  • Probability Distribution of a Random Variable:

    • Assigns a probability to every value xx in the domain range of XX
    • Notation: P(X=x)=∑{ω:X(ω)=x}P(ω)P(X = x) = \sum_{\{\omega : X(\omega) = x\}} P(\omega), abbreviated as P(x)P(x)
    • P(X)P(X) refers to the complete distribution (represented as a table or vector).

Joint Distributions

  • Definition:

    • A joint probability distribution over multiple variables X1,X2,…,XnX_1, X_2, \dots, X_n specifies the probability of every possible combination of variable assignments P(X1=x1,X2=x2,…,Xn=xn)P(X_1 = x_1, X_2 = x_2, \dots, X_n = x_n).
    • The sum of all entries across the entire joint table equals 1.01.0
  • Necessity of Joint Distributions:

    • Individual (marginal) distributions do not provide information about how variables interact or depend on each other.
    • Joint distributions capture all variable interactions and dependencies.
  • Fundamental Relationship:

    • Joint distributions cannot be deduced from individual marginal distributions alone (unless variables are known to be independent).
    • Marginal distributions can always be calculated directly from a joint distribution.
  • Canonical Example Table: P(T,W)P(T, W)

Weather (WW)Temperature (T=hotT = \text{hot})Temperature (T=coldT = \text{cold})
sun0.450.450.150.15
rain0.020.020.080.08
fog0.030.030.270.27
meteor0.000.000.000.00

Marginalization (Summing Out)

  • Definition:

    • The marginal distribution of a subset of variables is derived by eliminating (summing out) the unmentioned variables from a joint distribution.
  • Mathematical Formulas:

P(X=x)=∑yP(X=x,Y=y)P(X = x) = \sum_{y} P(X = x, Y = y)

P(Y=y)=∑xP(X=x,Y=y)P(Y = y) = \sum_{x} P(X = x, Y = y)

  • Derivations from the P(T,W)P(T, W) Joint Table:
    • Marginal distribution of Weather P(W)P(W):
    • P(W=sun)=0.45+0.15=0.60P(W = \text{sun}) = 0.45 + 0.15 = 0.60
    • P(W=rain)=0.02+0.08=0.10P(W = \text{rain}) = 0.02 + 0.08 = 0.10
    • P(W=fog)=0.03+0.27=0.30P(W = \text{fog}) = 0.03 + 0.27 = 0.30
    • P(W=meteor)=0.00+0.00=0.00P(W = \text{meteor}) = 0.00 + 0.00 = 0.00
    • Marginal distribution of Temperature P(T)P(T):
    • P(T=hot)=0.45+0.02+0.03+0.00=0.50P(T = \text{hot}) = 0.45 + 0.02 + 0.03 + 0.00 = 0.50
    • P(T=cold)=0.15+0.08+0.27+0.00=0.50P(T = \text{cold}) = 0.15 + 0.08 + 0.27 + 0.00 = 0.50

Dimensionality and Space Complexity

  • Possible Worlds:

    • A possible world represents a full assignment of values to every random variable in a model.
  • Distribution Size Complexity:

    • For nn random variables, each having a domain size of dd:
    • Number of entries in full joint distribution: dnd^n
    • Example: For two dice rolls (n=2,d=6n=2, d=6), joint size = 62=366^2 = 36.
    • Exponential size growth (O(dn)O(d^n)) makes manual entry or direct table storage unfeasible for large systems.

Probability of General Events

  • Using the joint distribution P(T,W)P(T, W), event probabilities are computed by summing matching table cells:
    • P(hot AND sun)=P(T=hot,W=sun)=0.45P(\text{hot AND sun}) = P(T = \text{hot}, W = \text{sun}) = 0.45
    • P(hot)=0.45+0.02+0.03+0.00=0.50P(\text{hot}) = 0.45 + 0.02 + 0.03 + 0.00 = 0.50
    • P(hot OR not fog)=P(hot)+P(cold, sun)+P(cold, rain)+P(cold, meteor)P(\text{hot OR not fog}) = P(\text{hot}) + P(\text{cold, sun}) + P(\text{cold, rain}) + P(\text{cold, meteor})
    • =0.50+0.15+0.08+0.00=0.73= 0.50 + 0.15 + 0.08 + 0.00 = 0.73

Practice Problems & Solutions

Practice Problem Set I

Using the original joint distribution table P(T,W)P(T, W):

  • Question 1: Compare P(sun)P(\text{sun}) vs. P(rain)P(\text{rain})

    • P(sun)=0.45+0.15=0.60P(\text{sun}) = 0.45 + 0.15 = 0.60
    • P(rain)=0.02+0.08=0.10P(\text{rain}) = 0.02 + 0.08 = 0.10
    • Higher: Option 1 (P(sun)=0.60P(\text{sun}) = 0.60
  • Question 2: Compare P(fog)P(\text{fog}) vs. P(hot)P(\text{hot})

    • P(fog)=0.03+0.27=0.30P(\text{fog}) = 0.03 + 0.27 = 0.30
    • P(hot)=0.45+0.02+0.03+0.00=0.50P(\text{hot}) = 0.45 + 0.02 + 0.03 + 0.00 = 0.50
    • Higher: Option 2 (P(hot)=0.50P(\text{hot}) = 0.50
  • Question 3: Compare P(cold,fog)P(\text{cold}, \text{fog}) vs. P(rain)P(\text{rain})

    • P(cold,fog)=0.27P(\text{cold}, \text{fog}) = 0.27
    • P(rain)=0.10P(\text{rain}) = 0.10
    • Higher: Option 1 (P(cold,fog)=0.27P(\text{cold}, \text{fog}) = 0.27
  • Question 4: Compare P(cold∣rain)P(\text{cold} \mid \text{rain}) vs. P(sun)P(\text{sun})

    • P(cold∣rain)=P(cold,rain)P(rain)=0.080.10=0.80P(\text{cold} \mid \text{rain}) = \frac{P(\text{cold}, \text{rain})}{P(\text{rain})} = \frac{0.08}{0.10} = 0.80
    • P(sun)=0.60P(\text{sun}) = 0.60
    • Higher: Option 1 (P(cold∣rain)=0.80P(\text{cold} \mid \text{rain}) = 0.80

Practice Problem Set II

Given modified marginals and conditional probability tables:

  • Marginal P(T)P(T): P(hot)=0.25P(\text{hot}) = 0.25, P(cold)=0.75P(\text{cold}) = 0.75

  • Conditional P(W∣T)P(W \mid T):

    • P(sun∣hot)=0.90P(\text{sun} \mid \text{hot}) = 0.90, P(rain∣hot)=0.04P(\text{rain} \mid \text{hot}) = 0.04, P(fog∣hot)=0.06P(\text{fog} \mid \text{hot}) = 0.06, P(meteor∣hot)=0.00P(\text{meteor} \mid \text{hot}) = 0.00
    • P(sun∣cold)=0.30P(\text{sun} \mid \text{cold}) = 0.30, P(rain∣cold)=0.16P(\text{rain} \mid \text{cold}) = 0.16, P(fog∣cold)=0.54P(\text{fog} \mid \text{cold}) = 0.54, P(meteor∣cold)=0.00P(\text{meteor} \mid \text{cold}) = 0.00
  • Question 1: Compare P(sun,hot)P(\text{sun}, \text{hot}) vs. P(sun,cold)P(\text{sun}, \text{cold})

    • P(sun,hot)=P(hot)P(sun∣hot)=0.25×0.90=0.225P(\text{sun}, \text{hot}) = P(\text{hot}) P(\text{sun} \mid \text{hot}) = 0.25 \times 0.90 = 0.225
    • P(sun,cold)=P(cold)P(sun∣cold)=0.75×0.30=0.225P(\text{sun}, \text{cold}) = P(\text{cold}) P(\text{sun} \mid \text{cold}) = 0.75 \times 0.30 = 0.225
    • Result: Neither is higher (Both equal 0.2250.225
  • Question 2: Compare P(sun)P(\text{sun}) vs. P(fog)P(\text{fog})

    • P(sun)=0.225+0.225=0.45P(\text{sun}) = 0.225 + 0.225 = 0.45
    • P(fog)=P(hot)P(fog∣hot)+P(cold)P(fog∣cold)=(0.25×0.06)+(0.75×0.54)=0.015+0.405=0.420P(\text{fog}) = P(\text{hot}) P(\text{fog} \mid \text{hot}) + P(\text{cold}) P(\text{fog} \mid \text{cold}) = (0.25 \times 0.06) + (0.75 \times 0.54) = 0.015 + 0.405 = 0.420
    • Higher: Option 1 (P(sun)=0.45P(\text{sun}) = 0.45
  • Question 3: Compare P(hot∣sun)P(\text{hot} \mid \text{sun}) vs. P(cold∣sun)P(\text{cold} \mid \text{sun})

    • P(hot∣sun)=P(sun,hot)P(sun)=0.2250.45=0.50P(\text{hot} \mid \text{sun}) = \frac{P(\text{sun}, \text{hot})}{P(\text{sun})} = \frac{0.225}{0.45} = 0.50
    • P(cold∣sun)=P(sun,cold)P(sun)=0.2250.45=0.50P(\text{cold} \mid \text{sun}) = \frac{P(\text{sun}, \text{cold})}{P(\text{sun})} = \frac{0.225}{0.45} = 0.50
    • Result: Equal probability (0.500.50
  • Question 4: Compare P(hot∣not fog)P(\text{hot} \mid \text{not fog}) vs. P(cold∣not fog)P(\text{cold} \mid \text{not fog})

    • P(not fog)=1−P(fog)=1−0.42=0.58P(\text{not fog}) = 1 - P(\text{fog}) = 1 - 0.42 = 0.58
    • P(not fog∣hot)=0.90+0.04=0.94P(\text{not fog} \mid \text{hot}) = 0.90 + 0.04 = 0.94
    • P(hot,not fog)=P(hot)P(not fog∣hot)=0.25×0.94=0.235P(\text{hot}, \text{not fog}) = P(\text{hot}) P(\text{not fog} \mid \text{hot}) = 0.25 \times 0.94 = 0.235
    • P(hot∣not fog)=0.2350.58≈0.405P(\text{hot} \mid \text{not fog}) = \frac{0.235}{0.58} \approx 0.405
    • P(cold∣not fog)=1−0.405=0.595P(\text{cold} \mid \text{not fog}) = 1 - 0.405 = 0.595
    • Higher: Option 2 (P(cold∣not fog)≈0.595P(\text{cold} \mid \text{not fog}) \approx 0.595

Conditional Probability and Normalization

  • Conditional Probability Formula:
    • Defines probability of event aa occurring given event bb has occurred:

P(a∣b)=P(a,b)P(b)P(a \mid b) = \frac{P(a, b)}{P(b)}

  • Calculation Example:

    • Calculate P(W=sun∣T=cold)P(W = \text{sun} \mid T = \text{cold}):
    • P(T=cold)=0.15+0.08+0.27+0.00=0.50P(T = \text{cold}) = 0.15 + 0.08 + 0.27 + 0.00 = 0.50
    • P(W=sun,T=cold)=0.15P(W = \text{sun}, T = \text{cold}) = 0.15
    • P(W=sun∣T=cold)=0.150.50=0.30P(W = \text{sun} \mid T = \text{cold}) = \frac{0.15}{0.50} = 0.30
  • Normalization Procedure:

    • Normalization scales a set of non-negative values so that their sum equals 1.01.0
    • Normalization constant α\alpha:

α=1P(b)=1∑aP(a,b)\alpha = \frac{1}{P(b)} = \frac{1}{\sum_{a} P(a, b)}

  • Expressing conditional distribution via normalization:

P(A∣b)=αP(A,b)P(A \mid b) = \alpha P(A, b)

  • Example for P(W∣T=cold)P(W \mid T = \text{cold}):

    • Unnormalized vector P(W,T=cold)=(0.150.080.270.00)P(W, T = \text{cold}) = \begin{pmatrix} 0.15 \\ 0.08 \\ 0.27 \\ 0.00 \end{pmatrix}

    • Sum =0.50  ⟹  α=10.50=2.0= 0.50 \implies \alpha = \frac{1}{0.50} = 2.0

    • Normalized distribution P(W∣T=cold)=2.0×(0.150.080.270.00)=(0.300.160.540.00)P(W \mid T = \text{cold}) = 2.0 \times \begin{pmatrix} 0.15 \\ 0.08 \\ 0.27 \\ 0.00 \end{pmatrix} = \begin{pmatrix} 0.30 \\ 0.16 \\ 0.54 \\ 0.00 \end{pmatrix}

    • Conditional Distribution Tables:

  • Table P(W∣T)P(W \mid T) contains two distinct, disjoint probability distributions:

WeatherP(W∣T=hot)P(W \mid T = \text{hot})P(W∣T=cold)P(W \mid T = \text{cold})
sun0.900.900.300.30
rain0.040.040.160.16
fog0.060.060.540.54
meteor0.000.000.000.00

Product Rule and Chain Rule

  • Product Rule:
    • Reconstructs joint probabilities from marginal and conditional probabilities:

P(a,b)=P(a∣b)P(b)=P(b∣a)P(a)P(a, b) = P(a \mid b) P(b) = P(b \mid a) P(a)

  • Chain Rule:
    • Generalized product rule for nn variables by sequential decomposition:

P(x1,x2,…,xn)=∏i=1nP(xi∣x1,…,xi−1)P(x_1, x_2, \dots, x_n) = \prod_{i=1}^{n} P(x_i \mid x_1, \dots, x_{i-1})

  • Expansions:
    • For 2 variables: P(x1,x2)=P(x2∣x1)P(x1)P(x_1, x_2) = P(x_2 \mid x_1) P(x_1)
    • For 3 variables: P(x1,x2,x3)=P(x3∣x1,x2)P(x2∣x1)P(x1)P(x_1, x_2, x_3) = P(x_3 \mid x_1, x_2) P(x_2 \mid x_1) P(x_1)
    • For 4 variables: P(x1,x2,x3,x4)=P(x4∣x1,x2,x3)P(x3∣x1,x2)P(x2∣x1)P(x1)P(x_1, x_2, x_3, x_4) = P(x_4 \mid x_1, x_2, x_3) P(x_3 \mid x_1, x_2) P(x_2 \mid x_1) P(x_1)

Probabilistic Inference & Enumeration

  • Probabilistic Inference:

    • Process of computing a target probability distribution from a probabilistic model given observed evidence.
    • Beliefs update dynamically upon receiving new evidence:
    • Prior belief: P(class on time∣no holidays)=0.90P(\text{class on time} \mid \text{no holidays}) = 0.90
    • Updated belief: P(class on time∣no holidays,10 a.m.)=0.95P(\text{class on time} \mid \text{no holidays}, 10\,\text{a.m.}) = 0.95
    • Further updated belief: P(class on time∣no holidays,10 a.m.,raining)=0.80P(\text{class on time} \mid \text{no holidays}, 10\,\text{a.m.}, \text{raining}) = 0.80
  • Variable Partitioning:

    • All variables in model X1,…,XnX_1, \dots, X_n partitioned into:
    • Evidence Variables EE: Observed variables with known values E=eE = e
    • Query Variables QQ: Target unobserved variables to infer
    • Hidden Variables HH: Unobserved, non-target variables
  • Inference by Enumeration Algorithm:

    1. Select: Filter full joint distribution table for entries matching evidence E=eE = e
    2. Sum Out: Marginalize out all hidden variables HH:

P(Q,e)=∑hP(Q,h,e)P(Q, e) = \sum_{h} P(Q, h, e)

  1. Normalize: Multiply by α=1∑qP(q,e)\alpha = \frac{1}{\sum_q P(q, e)} to obtain final distribution:

P(Q∣e)=αP(Q,e)P(Q \mid e) = \alpha P(Q, e)

  • Worked Example: P(Season∣W=sun)P(\text{Season} \mid W = \text{sun}):

    • Query (QQ): Season
    • Evidence (EE): Weather=sunWeather = sun
    • Hidden (HH): Temp
    • Step 1 & 2: Sum over hidden variable Temp:
    • P(summer,sun)=P(summer, hot, sun)+P(summer, cold, sun)=0.35+0.10=0.45P(\text{summer}, \text{sun}) = P(\text{summer, hot, sun}) + P(\text{summer, cold, sun}) = 0.35 + 0.10 = 0.45
    • P(winter,sun)=P(winter, hot, sun)+P(winter, cold, sun)=0.10+0.15=0.25P(\text{winter}, \text{sun}) = P(\text{winter, hot, sun}) + P(\text{winter, cold, sun}) = 0.10 + 0.15 = 0.25
    • Step 3: Normalize:
    • Total sum =0.45+0.25=0.70  ⟹  α=10.70= 0.45 + 0.25 = 0.70 \implies \alpha = \frac{1}{0.70}
    • P(summer∣sun)=0.450.70≈0.64P(\text{summer} \mid \text{sun}) = \frac{0.45}{0.70} \approx 0.64
    • P(winter∣sun)=0.250.70≈0.36P(\text{winter} \mid \text{sun}) = \frac{0.25}{0.70} \approx 0.36
    • Distribution: {summer:0.64,winter:0.36}\{\text{summer}: 0.64, \text{winter}: 0.36\}
  • Complexity Issues with Enumeration:

    • Time Complexity: O(dn)O(d^n) (exponential in variable count nn)
    • Space Complexity: O(dn)O(d^n) (must store complete joint table)

Bayes' Rule and Applications

  • Mathematical Derivation:
    • From product rule: P(a,b)=P(a∣b)P(b)=P(b∣a)P(a)P(a, b) = P(a \mid b) P(b) = P(b \mid a) P(a)
    • Dividing by P(b)P(b) yields Bayes' Rule:

P(a∣b)=P(b∣a)P(a)P(b)P(a \mid b) = \frac{P(b \mid a) P(a)}{P(b)}

  • Terminology:

    • P(a)P(a): Prior probability (unconditional belief of aa)
    • P(b∣a)P(b \mid a): Likelihood (probability of evidence bb given aa)
    • P(b)P(b): Total Evidence probability
    • P(a∣b)P(a \mid b): Posterior probability (updated belief of aa given evidence bb)
  • Medical Diagnostic Application:

    • Given:
    • Likelihood P(positive∣covid)=0.80P(\text{positive} \mid \text{covid}) = 0.80
    • Prior P(covid)=0.0001P(\text{covid}) = 0.0001
    • Evidence P(positive)=0.01P(\text{positive}) = 0.01
    • Posterior Calculation:

P(covid∣positive)=P(positive∣covid)P(covid)P(positive)=0.80×0.00010.01=0.008P(\text{covid} \mid \text{positive}) = \frac{P(\text{positive} \mid \text{covid}) P(\text{covid})}{P(\text{positive})} = \frac{0.80 \times 0.0001}{0.01} = 0.008

  • Interpretation: The posterior is low (0.8%0.8\%

    • Dog Breed Probability Examples:
  • Scenario A: Two dogs (Hodu and Maru). Each is equally likely Maltese (MM) or Poodle (PP).

    • Outcomes: {(P,P),(P,M),(M,P),(M,M)}\{(P,P), (P,M), (M,P), (M,M)\}
    • P(both poodles)=14=25%P(\text{both poodles}) = \frac{1}{4} = 25\%
  • Scenario B: Given that at least one dog is a poodle, what is P(both poodles)P(\text{both poodles})?

    • Event aa (at least one poodle): {(P,P),(P,M),(M,P)}  ⟹  P(a)=34\{(P,P), (P,M), (M,P)\} \implies P(a) = \frac{3}{4}
    • Event bb (both poodles): {(P,P)}  ⟹  P(b)=14\{(P,P)\} \implies P(b) = \frac{1}{4}
    • P(a∣b)=1.0P(a \mid b) = 1.0
    • Applying Bayes' Rule:

P(b∣a)=P(a∣b)P(b)P(a)=1.0×1434=13≈33.33%P(b \mid a) = \frac{P(a \mid b) P(b)}{P(a)} = \frac{1.0 \times \frac{1}{4}}{\frac{3}{4}} = \frac{1}{3} \approx 33.33\%

Conditional Independence

  • Independence Definition:
    • XX and YY are independent (X⊥ ⁣ ⁣⊥YX \perp \! \! \perp Y) if:

∀x,yP(x,y)=P(x)P(y)  ⟺  P(x∣y)=P(x)\forall x, y \quad P(x, y) = P(x) P(y) \iff P(x \mid y) = P(x)

  • Conditional Independence Definition:
    • XX and YY are conditionally independent given ZZ (X⊥ ⁣ ⁣⊥Y∣ZX \perp \! \! \perp Y \mid Z) if:

∀x,y,zP(x∣y,z)=P(x∣z)andP(y∣x,z)=P(y∣z)\forall x, y, z \quad P(x \mid y, z) = P(x \mid z) \quad \text{and} \quad P(y \mid x, z) = P(y \mid z)

  • Equivalent joint factorization given ZZ:

∀x,y,zP(x,y∣z)=P(x∣z)P(y∣z)\forall x, y, z \quad P(x, y \mid z) = P(x \mid z) P(y \mid z)

  • Ghostbusters Grid Example:

Ghostbusters Revisiting Game UI

  • Setup: Ghost location G∈{(1,1),…,(3,3)}G \in \{(1,1), \dots, (3,3)\} (9 possible locations). Sensors at grid locations Cx,y∈{red,orange,yellow,green}C_{x,y} \in \{\text{red}, \text{orange}, \text{yellow}, \text{green}\}.
  • Sensor Model: P(Cx,y∣G)P(C_{x,y} \mid G) depends strictly on distance to ghost GG
  • Full Joint Size without Independence:
    • 9×49=2,359,2969 \times 4^9 = 2,359,296 parameters.
  • Applying Conditional Independence:
    • Sensor reading C1,1C_{1,1} is conditionally independent of C1,2C_{1,2} given ghost location GG:

P(C1,1∣G,C1,2)=P(C1,1∣G)P(C_{1,1} \mid G, C_{1,2}) = P(C_{1,1} \mid G)

  • Decomposed Joint Formula:

P(G,C1,1,…,C3,3)=P(G)∏x,yP(Cx,y∣G)P(G, C_{1,1}, \dots, C_{3,3}) = P(G) \prod_{x,y} P(C_{x,y} \mid G)

  • Reduced Parameter Count: 9+(9×4×9)=3249 + (9 \times 4 \times 9) = 324 parameters (quadratic reduction vs exponential).
  • Naïve Bayes Structure: Model containing one discrete query variable GG influencing multiple conditionally independent evidence variables Cx,yC_{x,y}.

Bayesian Networks

  • Definition:

    • A Bayesian Network is a directed acyclic graph (DAG) structure combined with local conditional probability tables (CPTs) that compactly represents a full joint probability distribution.
  • Representation Components:

    • Nodes: Represent random variables XiX_i with specified domains.
    • Directed Arcs: Represent direct causal or statistical influences (X→YX \rightarrow Y).
    • Absence of Arcs: Encodes explicit conditional independence relationships.
    • Conditional Probability Tables (CPTs): Quantify relationships; each node has a table specifying P(Xi∣Parents(Xi))P(X_i \mid \text{Parents}(X_i)).
  • Dental Diagnostic Example:

Bayes Net Cavity Example Diagram

  • Node Cavity directly points to Toothache and Catch.
  • Absence of direct arc between Toothache and Catch means Toothache and Catch are conditionally independent given Cavity:

P(Toothache,Catch∣Cavity)=P(Toothache∣Cavity)P(Catch∣Cavity)P(\text{Toothache}, \text{Catch} \mid \text{Cavity}) = P(\text{Toothache} \mid \text{Cavity}) P(\text{Catch} \mid \text{Cavity})

  • Bayes Net Syntax & Semantics:
    • A Bayes Net is defined by:

Bayes Net=Topology (DAG Graph)+Local Conditional Probabilities (CPTs)\text{Bayes Net} = \text{Topology (DAG Graph)} + \text{Local Conditional Probabilities (CPTs)}

  • Full joint distribution encoded by a Bayes Net is constructed via the chain rule for Bayes nets:

P(X1,X2,…,Xn)=∏i=1nP(Xi∣Parents(Xi))P(X_1, X_2, \dots, X_n) = \prod_{i=1}^{n} P(X_i \mid \text{Parents}(X_i))