Advanced Machine Learning Notes
Advanced Machine Learning Notes
Learning
• Introduction
• Representation
• Some materials are courtesy of Vibhave Gogate, Eric Xing and Bishop.
• All pictures belong to their creators.
Test 1 1 0 0 0.20
1 1 0 0.15
Pr 𝑥 = 0 𝑧 = 1 =?
𝑑
𝑐
• Generalizes simple Bayesian methods such Naïve Bayes and logistic regression.
• Child:
𝑒
Representation
𝑦 = 𝑎𝑥 + 𝑏 Conjunction of constraints.
Graph Model?
𝑎 𝑏
Test 2
𝑎 𝑏 𝑎 𝑐
𝑐 𝑏
𝑎 𝑏
For each node 𝑎, Pr[𝑎|𝑎’parents].
𝑎 𝑏 𝑎 𝑐
𝑐 𝑏
𝑎 𝑏
For each node 𝑎, Pr[𝑎|𝑎’parents].
Pr 𝑎, 𝑏, 𝑐 =? ?
𝑎 𝑏 𝑎 𝑐
𝑐 𝑏
• Pr[𝑥6 |𝑥4 ] Pr[𝑥7 |𝑥4 , 𝑥5 ] Pr[𝑥5 |𝑥1 , 𝑥3 ]Pr[𝑥4 |𝑥1 , 𝑥2 , 𝑥3 ] Pr[𝑥1 ]Pr[𝑥2 ]Pr[𝑥3 ]
Pr[𝑐|𝑎, 𝑏]
Conditional Independence
𝑒
Is 𝑎 independent of 𝑏?
Is 𝑎 independent of 𝑏 given 𝑐?
𝑥1 𝑥2 𝑥𝑛
𝑦
• missing link: independence
𝑥1 𝑥2 𝑥𝑛
𝑥1 𝑥2 𝑥𝑛
𝑥1 𝑥2 𝑥𝑛
𝑎
Paths from a to c
𝑐
a→b→d←c 𝑏
a→b→d→e←c
a→b→e←c 𝑑
a→b→e←d←c
𝑒
(Type 1: causal chains, Type 2: common cause, Type 3 : common effect)
Burglary Self-protection
Alarm
Earthquake Call for help
Burglary Self-protection
Alarm
Earthquake Call for help
Pr 𝑠, 𝑟, 𝑡 Pr 𝑠 Pr 𝑟 𝑠 Pr 𝑡 𝑟 Pr 𝑠, 𝑟 Pr 𝑡 𝑟
Pr 𝑠, 𝑡 𝑟 = = = = Pr 𝑠|𝑟 Pr 𝑡 𝑟
Pr 𝑟 Pr 𝑟 Pr 𝑟
Introduction to Machine Learning Amo G. Tong 34
Conditional Independence: d-separation: Causal Chain
• A path (ignore the direction) between 𝑎 ∈ 𝐴 and 𝑏 ∈ 𝐵 is composed of triples (𝑠, 𝑟, 𝑡)
𝑠 𝑟 𝑡 𝑠 𝑟 𝑡 𝑠 𝑟 𝑡
Burglary Self-protection
Alarm
Rule 1: a path is
Earthquake Call for help
blocked, if it has
a causal chain
• Type 1: Causal chain triple block.
• Burglary(s) → Alarm(r) → Call(t)
• Pr[𝑠, 𝑟, 𝑡] = Pr[𝑠]Pr[𝑟|𝑠]Pr[𝑡|𝑟]
• If 𝑟 is given, 𝑠 and 𝑡 are independent. (causal chain block)
Pr 𝑠, 𝑟, 𝑡 Pr 𝑠 Pr 𝑟 𝑠 Pr 𝑡 𝑟 Pr 𝑠, 𝑟 Pr 𝑡 𝑟
Pr 𝑠, 𝑡 𝑟 = = = = Pr 𝑠|𝑟 Pr 𝑡 𝑟
Pr 𝑟 Pr 𝑟 Pr 𝑟
Introduction to Machine Learning Amo G. Tong 35
Conditional Independence: d-separation: Common Cause
• A path (ignore the direction) between 𝑎 ∈ 𝐴 and 𝑏 ∈ 𝐵 is composed of triples (𝑠, 𝑟, 𝑡)
𝑠 𝑟 𝑡 𝑠 𝑟 𝑡 𝑠 𝑟 𝑡
Burglary Self-protection
Alarm
Earthquake Call for help
Burglary Self-protection
Alarm
Rule 2: a path is
Earthquake Call for help blocked, if it has
a common cause
• Type 2: Common cause triple block.
• Call(s) ← Alarm(r) → Self-protection(t)
• Pr[𝑠, 𝑟, 𝑡] = Pr[𝑡|𝑟]Pr[𝑠|𝑟]Pr[𝑟]
• If 𝑟 is given, 𝑠 and 𝑡 are independent. (common cause block)
Pr 𝑠, 𝑟, 𝑡 Pr[𝑡|𝑟]Pr[𝑠|𝑟]Pr[𝑟]
Pr 𝑠, 𝑡 𝑟 = = = Pr 𝑠|𝑟 Pr 𝑡 𝑟
Pr 𝑟 Pr 𝑟
Introduction to Machine Learning Amo G. Tong 37
Conditional Independence: d-separation: Common Effect
• A path (ignore the direction) between 𝑎 ∈ 𝐴 and 𝑏 ∈ 𝐵 is composed of triples (𝑠, 𝑟, 𝑡)
𝑠 𝑟 𝑡 𝑠 𝑟 𝑡 𝑠 𝑟 𝑡
Burglary Self-protection
Alarm
Earthquake Call for help
Burglary Self-protection
Alarm
Earthquake Call for help
Burglary Self-protection
Alarm
Earthquake Call for help
Burglary Self-protection
Alarm
Earthquake Call for help
𝑠
Burglary 𝑟 𝑡 Self-protection
Alarm
𝒔
Earthquake Call for help
0 0.3
1 0.7
• Type 3: Common Effect Two independent variables
• Burglary(s) → Alarm(r) ← Earthquake(t)
• Pr[𝑠,𝒕 𝑟, 𝑡] = Pr[𝑟|𝑠, 𝑡]Pr[𝑠]Pr[𝑡]
• If 0none
0.4of 𝒓 and its descendants is given, 𝑠 and 𝑡 are independent. (block a
common
1 0.6
effect)
• If 𝒓 or its descendants is given, 𝑠 and 𝑡 are not independent. (𝑟 enforces some
relationship between 𝑠 and 𝑡.)
Introduction to Machine Learning Amo G. Tong 42
Conditional Independence: d-separation: Common Effect
• A path (ignore the direction) between 𝑎 ∈ 𝐴 and 𝑏 ∈ 𝐵 is composed of triples (𝑠, 𝑟, 𝑡)
Common effect:
𝑠 𝑟 𝑡 𝑠 𝑟 𝑡 𝑠 𝑟 𝑡
𝑠
Burglary 𝑟 𝑡 Self-protection
Joint distribution of 𝑠 and 𝑡
Alarm
𝒔
Earthquake 𝒔 𝒕 Call forAllocate
help 0.3 into two places.
0 0.3 The ratio 4:6 is kept.
0 0.3 0 0.12
1 0.7
• Type 3: Common Effect 1 0.18 Pr[t=0]=0.12+0.28/1=0.4
• Burglary(s) → Alarm(r) ← Earthquake(t) Pr[t=0|s=0]=0.12/(0.12+0.18)=0.4
1
• Pr[𝑠,𝒕 𝑟, 𝑡] = Pr[𝑟|𝑠, 0.7 0
𝑡]Pr[𝑠]Pr[𝑡] 0.28 Pr[t=0|s=1]=0.28/(0.28+0.42)=0.4
• If 0none
0.4of 𝒓 and its descendants
1 is given, 𝑠 and 𝑡 are independent. (block a
0.42
common
1 0.6
effect)
• If 𝒓 or its descendants is given, 𝑠 and 𝑡 are not independent. (𝑟 enforces some
relationship between 𝑠 and 𝑡.)
Introduction to Machine Learning Amo G. Tong 43
Conditional Independence: d-separation: Common Effect
• A path (ignore the direction) between 𝑎 ∈ 𝐴 and 𝑏 ∈ 𝐵 is composed of triples (𝑠, 𝑟, 𝑡)
Common effect:
𝑠 𝑟 𝑡 𝑠 𝑟 𝑡 𝑠 𝑟 𝑡
𝒔 𝒕 𝒓
𝑠 𝑡 𝑟 Self-protection0 0.12 1 ?
Burglary
Alarm 0 ?
Joint distribution of 𝑠, 𝑡 and 𝑟 0 0.3
Earthquake Call for help 1 0.18 1 ?
Allocate 0.12 into two places. 0 ?
Can3:beCommon
• Type [Link]
0 0.28 1 ?
• Burglary(s) → Alarm(r) ← Earthquake(t) 0 ?
• Pr[𝑠, 𝑟, 𝑡] = Pr[𝑟|𝑠, 𝑡]Pr[𝑠]Pr[𝑡] 1 0.7
1 0.42 1 ?
• 5If none of 𝒓 and its descendants is given, 𝑠 and 𝑡 are independent. (block a
Test
common effect) 0 ?
• If 𝒓 or its descendants is given, 𝑠 and 𝑡 are not independent. (𝑟 enforces some
relationship between 𝑠 and 𝑡.)
Introduction to Machine Learning Amo G. Tong 44
Conditional Independence: d-separation: Common Effect
• A path (ignore the direction) between 𝑎 ∈ 𝐴 and 𝑏 ∈ 𝐵 is composed of triples (𝑠, 𝑟, 𝑡)
Common effect:
𝑠 𝑟 𝑡 𝑠 𝑟 𝑡 𝑠 𝑟 𝑡
𝒔 𝒕 𝒓
Burglary Self-protection
Alarm
Rule3 : a path is
Earthquake Call for help blocked, if it has
a common effect
• Type 3: Common effect triple block.
• Burglary(s) → Alarm(r) ← Earthquake(t)
• Pr[𝑠, 𝑟, 𝑡] = Pr[𝑟|𝑠, 𝑡]Pr[𝑠]Pr[𝑡]
• If none of 𝒓 and its descendants is given, 𝑠 and 𝑡 are independent. (block a
common effect)
• If 𝒓 or its descendants is given, 𝑠 and 𝑡 are not necessarily independent.
(𝑟 enforces some relationship between 𝑠 and 𝑡.)
Introduction to Machine Learning Amo G. Tong 48
Conditional Independence: d-separation: Summary
• General: Given a Bayesian network, and three sets 𝐴, 𝐵, 𝐶 of variables, if 𝐴 is
independent of 𝐵 given 𝐶?
• A path (ignore the direction) between 𝑎 ∈ 𝐴 and 𝑏 ∈ 𝐵 is composed of triples (𝑠, 𝑟, 𝑡)
𝑠 𝑟 𝑡 𝑠 𝑟 𝑡 𝑠 𝑟 𝑡
𝑎
𝑎⊥𝑑 Test 6
𝑐
𝑏 𝑎 ⊥ 𝑑|𝑏
𝑎⊥𝑐
𝑑 𝑎 ⊥ 𝑐|𝑏
𝑎 ⊥ 𝑐|𝑑
𝑎 ⊥ 𝑐|{𝑑, 𝑒}
𝑟
• Naïve Bayes is a special case.