Artificial Intelligence - Bayesian Networks and Probability Basics
Course Overview & Schedule
- Course Name: COSE361 Artificial Intelligence
- Primary Module: Bayesian Networks & Probabilistic Reasoning
| Week | Day | Content | Note |
|---|---|---|---|
| 1-1 | September 2 (Wed) | Introduction | |
| 1-2 | September 7 (Mon) | Search | |
| 2-1 | September 9 (Wed) | Games | |
| 2-2 | September 14 (Mon) | Bayesian Networks | |
| 3-1 | September 16 (Wed) | Bayesian Networks, HW1 | |
| 3-2 | September 21 (Mon) | Tutorial 1 | |
| 4-1 | September 23 (Wed) | Mid-term exam | |
| 4-2 | September 28 (Mon) | Hidden Markov Models | |
| 5-1 | September 30 (Wed) | Markov Decision Processes | |
| 5-2 | October 5 (Mon) | No Class | Holiday |
| 6-1 | October 7 (Wed) | Machine Learning | |
| 6-2 | October 12 (Mon) | Deep Learning Basics, HW2 | |
| 7-1 | October 14 (Wed) | Tutorial 2 | |
| 7-2 | October 19 (Mon) | Final exam | |
| -- | October 20 ~ | No classes | |
| 8-1 | December 14 (Mon) | Optional project presentation | Tentative, Extra points |
| 8-2 | December 16 (Wed) | Optional project presentation | Tentative, Extra points |
Uncertainty and Utility
Nature of the Real World:
- Real-world environments are inherently uncertain.
- Example scenario: Leaving for Incheon International Airport (ICN) 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 that maximizes its expected utility across all possible states :
Discrete Probability Fundamentals
Outcome Space (Sample Space):
- Defined as a set containing all possible world outcomes .
- Example: Rolling a single standard six-sided die gives .
Probability Model:
- Assigns a numeric probability to every individual outcome .
- For a fair die: .
Probability Axioms / Constraints:
- Non-negativity: for all
- Normalization:
Events:
- An event is any subset of outcomes:
- The probability of event is the sum of probabilities of its constituent outcomes:
- Examples:
- Event "roll ":
- Event "roll is odd":
Random Variables
Definition:
- A random variable represents a specific feature or aspect of the world whose value is uncertain.
- Formally, a random variable is a deterministic function mapping an outcome to a specific domain value.
- Denoted using uppercase letters (e.g., ).
Domains / Ranges of Random Variables:
- Boolean / Discrete Domain:
- where ,
- Continuous Domain:
- (e.g., time to travel to the airport)
- Spatial / Coordinate Domain:
Probability Distribution of a Random Variable:
- Assigns a probability to every value in the domain range of
- Notation: , abbreviated as
- refers to the complete distribution (represented as a table or vector).
Joint Distributions
Definition:
- A joint probability distribution over multiple variables specifies the probability of every possible combination of variable assignments .
- The sum of all entries across the entire joint table equals
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:
| Weather () | Temperature () | Temperature () |
|---|---|---|
| sun | ||
| rain | ||
| fog | ||
| meteor |
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:
- Derivations from the Joint Table:
- Marginal distribution of Weather :
- Marginal distribution of Temperature :
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 random variables, each having a domain size of :
- Number of entries in full joint distribution:
- Example: For two dice rolls (), joint size = .
- Exponential size growth () makes manual entry or direct table storage unfeasible for large systems.
Probability of General Events
- Using the joint distribution , event probabilities are computed by summing matching table cells:
Practice Problems & Solutions
Practice Problem Set I
Using the original joint distribution table :
Question 1: Compare vs.
- Higher: Option 1 (
Question 2: Compare vs.
- Higher: Option 2 (
Question 3: Compare vs.
- Higher: Option 1 (
Question 4: Compare vs.
- Higher: Option 1 (
Practice Problem Set II
Given modified marginals and conditional probability tables:
Marginal : ,
Conditional :
- , , ,
- , , ,
Question 1: Compare vs.
- Result: Neither is higher (Both equal
Question 2: Compare vs.
- Higher: Option 1 (
Question 3: Compare vs.
- Result: Equal probability (
Question 4: Compare vs.
- Higher: Option 2 (
Conditional Probability and Normalization
- Conditional Probability Formula:
- Defines probability of event occurring given event has occurred:
Calculation Example:
- Calculate :
Normalization Procedure:
- Normalization scales a set of non-negative values so that their sum equals
- Normalization constant :
- Expressing conditional distribution via normalization:
Example for :
Unnormalized vector
Sum
Normalized distribution
Conditional Distribution Tables:
Table contains two distinct, disjoint probability distributions:
| Weather | ||
|---|---|---|
| sun | ||
| rain | ||
| fog | ||
| meteor |
Product Rule and Chain Rule
- Product Rule:
- Reconstructs joint probabilities from marginal and conditional probabilities:
- Chain Rule:
- Generalized product rule for variables by sequential decomposition:
- Expansions:
- For 2 variables:
- For 3 variables:
- For 4 variables:
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:
- Updated belief:
- Further updated belief:
Variable Partitioning:
- All variables in model partitioned into:
- Evidence Variables : Observed variables with known values
- Query Variables : Target unobserved variables to infer
- Hidden Variables : Unobserved, non-target variables
Inference by Enumeration Algorithm:
- Select: Filter full joint distribution table for entries matching evidence
- Sum Out: Marginalize out all hidden variables :
- Normalize: Multiply by to obtain final distribution:
Worked Example: :
- Query (): Season
- Evidence ():
- Hidden (): Temp
- Step 1 & 2: Sum over hidden variable Temp:
- Step 3: Normalize:
- Total sum
- Distribution:
Complexity Issues with Enumeration:
- Time Complexity: (exponential in variable count )
- Space Complexity: (must store complete joint table)
Bayes' Rule and Applications
- Mathematical Derivation:
- From product rule:
- Dividing by yields Bayes' Rule:
Terminology:
- : Prior probability (unconditional belief of )
- : Likelihood (probability of evidence given )
- : Total Evidence probability
- : Posterior probability (updated belief of given evidence )
Medical Diagnostic Application:
- Given:
- Likelihood
- Prior
- Evidence
- Posterior Calculation:
Interpretation: The posterior is low (
- Dog Breed Probability Examples:
Scenario A: Two dogs (Hodu and Maru). Each is equally likely Maltese () or Poodle ().
- Outcomes:
Scenario B: Given that at least one dog is a poodle, what is ?
- Event (at least one poodle):
- Event (both poodles):
- Applying Bayes' Rule:
Conditional Independence
- Independence Definition:
- and are independent () if:
- Conditional Independence Definition:
- and are conditionally independent given () if:
- Equivalent joint factorization given :
- Ghostbusters Grid Example:

- Setup: Ghost location (9 possible locations). Sensors at grid locations .
- Sensor Model: depends strictly on distance to ghost
- Full Joint Size without Independence:
- parameters.
- Applying Conditional Independence:
- Sensor reading is conditionally independent of given ghost location :
- Decomposed Joint Formula:
- Reduced Parameter Count: parameters (quadratic reduction vs exponential).
- Naïve Bayes Structure: Model containing one discrete query variable influencing multiple conditionally independent evidence variables .
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 with specified domains.
- Directed Arcs: Represent direct causal or statistical influences ().
- Absence of Arcs: Encodes explicit conditional independence relationships.
- Conditional Probability Tables (CPTs): Quantify relationships; each node has a table specifying .
Dental Diagnostic Example:

- Node
Cavitydirectly points toToothacheandCatch. - Absence of direct arc between
ToothacheandCatchmeansToothacheandCatchare conditionally independent givenCavity:
- Bayes Net Syntax & Semantics:
- A Bayes Net is defined by:
- Full joint distribution encoded by a Bayes Net is constructed via the chain rule for Bayes nets: