Professional Documents
Culture Documents
A Tutorial On Inference and Learning in Bayesian Networks PDF
A Tutorial On Inference and Learning in Bayesian Networks PDF
Irina Rish
1 + 2 + 2 + 4 + 4 = 13 parameters instead of 2 \ = ZY
Example: Printer Troubleshooting
Application
Output OK
Spool Print
Process OK Spooling On
Spooled GDI Data
Data OK Input OK
Local Disk Uncorrupted
Space Adequate Driver
Correct GDI Data
Driver Output OK Correct
Driver
Settings
Correct
Printer Print
Selected Data OK
Network Net/Local
Up Printing
Correct
Correct Net PC to Printer Local Local Port
Printer Path Path OK Transport OK Path OK
Local Cable
Connected
Net Cable Paper
Connected Loaded
Printer On Printer
and Online Data OK
Printer Memory
Print Output Adequate
OK
26 variables
Instead of 2 26 parameters we get
99 = 17x1 + 1x21 + 2x2 2 + 3x2 3 + 3x 2 4
[Heckerman, 95]
“Moral” graph of a BN
Moralization algorithm:
P(S)
1. Connect (“marry”) parents Smoking
P(B|S)
of each node. P(C|S)
2. Drop the directionality of lung Cancer Bronchitis
the edges.
P(D|C,B)
Resulting undirected graph is X-ray Dyspnoea
called the “moral” graph of BN P(X|C,S)
Interpretation:
every pair of nodes that occur together in a CPD is connected by an edge in the moral graph.
CPD for X and its k parents (called “family”) is represented by a clique of size
k
(k+1) in the moral graph, and contains d ( d − 1) probability parameters where
d is the number of values each variable can have (domain size).
Conditional Independence in BNs:
Three types of connections
Serial S Diverging
Smoking
Visit to Asia L B
A Lung Cancer Bronchitis
Knowing S makes L and B
T Tuberculosis independent (common cause)
L Converging B
X Chest X-ray
Lung Cancer Bronchitis
Knowing T makes
A and X independent NOT knowing D or M
(intermediate cause) D Dyspnoea
makes L and B
M independent
Running (common effect)
Marathon
d-separation
Nodes X and Y are d-separated if on any (undirected) path between X and
Y there is some variable Z such that is either
Z is in a serial or diverging connection and Z is known, or
Z is in a converging connection and neither Z nor any of Z’s descendants are
known
X Z X Y
Z X Y Z
Y M
Smoking
Lung Cancer
Bronchitis
Age Gender
Diet Cancer
Prediction: P(symptom|cause)=?
C1 C2
Classification: max P(class|data)
class
Decision-making (given a cost function) symptom
Medicine
Speech Bio-
informatics
recognition
Text
Classification Computer
Stock market
troubleshooting
Application Examples
APRI system developed at AT&T Bell Labs
learns & uses Bayesian networks from data to identify customers
liable to default on bill payments
NASA Vista system
predict failures in propulsion systems
considers time criticality & suggests highest utility action
dynamically decide what information to show
Application Examples
Office Assistant in MS Office 97/ MS Office 95
Extension of Answer wizard
uses naïve Bayesian networks
help based on past experience (keyboard/mouse use) and task user is doing currently
This is the “smiley face” you get in your MS Office applications
Microsoft Pregnancy and Child-Care
Available on MSN in Health section
Frequently occurring children’s symptoms are linked to expert modules that repeatedly
ask parents relevant questions
Asks next best question based on provided information
Presents articles that are deemed relevant based on information provided
IBM’s systems management applications
Machine Learning for Systems @ Watson
End-user transaction
Fault diagnosis using probes
recognition Software or hardware
components X
2
X 3
Issues:
Remote Procedure Calls (RPCs) Efficiency (scalability)
X 1
Missing data/noise:
R2 R5 R3 R2 R1 R2 R5 sensitivity analysis
“Adaptive” probing:
selecting “most-
informative” probes
on-line
Transaction1 Transaction2 T4
learning/model
T1 updates
T3
BUY? OPEN_DB? Probe outcomes T 2 on-line diagnosis
SELL? SEARCH? Goal: finding most-likely diagnosis
OXQ S…Q ) = GwOXS… £XS… P
: S…_
Pattern
Patterndiscovery,
discovery,classification,
classification,
diagnosis
diagnosisand
andprediction
prediction
Probabilistic Inference Tasks
Belief updating:
BEL(Xi ) = P(Xi = x i | evidence)
X-ray Dyspnoea
P (smoking| dyspnoea=yes ) = ?
Belief updating: find P(X|evidence)
P(s, d = 1)
P(s|d=1) = ∝ P(s, d = 1) =
S P(d = 1)
CC B
B ∑ P(s)P(c|s)P(b|s)P(x|c,s)P(d|c,b)=
d =1,b , x ,c
X
X D
D
P(s) ∑ ∑ P(b|s) ∑ ∑ P(c|s)P(x|c,s)P(d|c,b)
d =1 b x c
“Moral” graph
Variable Elimination
f ( s , d , b, x )
W*=4
Complexity: O(n exp(w*)) ”induced width”
(max induced clique size)
Efficient inference: variable orderings, conditioning, approximations
Variable elimination algorithms
(also called “bucket-elimination”)
∑
is replaced by max :
MPE = max P ( a ) P ( c | a ) P ( b | a ) P ( d | a , b ) P ( e | b, c )
a , e , d , c ,b
max
b
∏ Elimination operator
bucket B: P(b|a) P(d|b,a) P(e|b,c) B
bucket C: P(c|a) h B
(a, d, c, e) C
bucket D: h C (a, d, e)
D
D
bucket E: e=0 h (a, e)
E
h E (a) W*=4
bucket A: P(a) ”induced width” A
MPE (max clique size)
probability
Generating the MPE-solution
5. b' = arg max P(b | a' ) ×
b B: P(b|a) P(d|b,a) P(e|b,c)
× P(d' | b, a' ) × P(e' | b, c' )
C D: h C (a, d, e)
3. d' = arg max h (a' , d, e' )
d
E: e=0 h D (a, e)
2. e' = 0
The width wo (X) of a variable X in graph G along the ordering o is the number
of nodes preceding X in the ordering and connected to X (earlier neighbors ).
The width wo of a graph is the maximum width wo (X) among all nodes.
The induced graph G ' along the ordering o is obtained by recursivel y connecting
earlier neighbors of each node, from last to the first in the ordering.
The width of the induced graph G' is called the induced width of the graph G
(denoted wo* ).
A B E
C D
B C D C
E B
D E A A
“Moral” graph wo*1 = 4 wo*2 = 2
Ordering is important! But finding min-w* ordering is NP- hard…
Inference is also NP-hard in general case [Cooper].
Learning Bayesian Networks
Incomplete data: X D X D
structural EM,
mixture models ˆ = arg max Score(G)
G
G
Learning Parameters: complete data
(overview)
Maximization E P ( X ) [ N x ,pa X ] =
Update parameters N
log N
MDL( BN | D ) = − log P ( D | Θ, G ) + |Θ|
2
DL(Data|model) DL(Model)
Class Class
P(f1 | class) P(f 2 | class) P(fn | class) P(f1 | class) P(f 2 | class) P(fn | class)
TAN:
tree-augmented Naïve Bayes Class
[Friedman et al. 1997]
P(f1 | class) P(f 2 | class) P(fn | class)
Based on Chow-Liu Tree Method
feature f1 feature f 2 feature f n
(CL) for learning trees
[Chow-Liu, 1968]
Tree-structured distributions
A joint probability distribution is tree-structured if it can be written as
n
) = ∏ P ( x i | x j ( i ) )
P (
i =1
where x j ( i ) is the parent of xi in Bayesian network for P(x) (a directed tree)
A
A
C
B
C
B
P(A,B,C,D,E)= D E
D E P(A)P(B|A)P(C|A)
P(D|C)P(E|B) Not a tree – has an (undirected) cycle
A tree (with root A)
A A
C C
B B
D E E
D
P ( )
D ( P, P' ) = P ∑ P() log
P ' ()
D(P,P’) is non-negative, and D(P,P’)=0 if and only if P coincides with P’ (on a set of measure 1)
A known fact : given P(x), the maximum of ∑ P(x) log P ' ( x) is achieved by the choice P' (x) = P(x).
xi
Therefore, for any value of i and x j ( i ) , the term ∑ P(x | x ) log P ' ( x | x ) is maximized by
i j (i ) i j (i )
xi
choosing P ' ( x i | x j ( i ) ) = P ( x i | x j ( i ) ) (and thus the total D ( P , P ' ) is minimized ) , which proves the Lemma.
Proof of Theorem :
Replacing P ' ( x i | x j ( i ) ) = P ( xi | x j ( i ) ) in the expression (1) yields
n
D ( P, P ' ) = −∑ ∑ P(x , x i j (i ) ) log[ P ( x i x j ( i ) ) / P ( x j ( i ) )] −H ( X ) =
i =1 xi , x j ( i )
n P ( xi x j (i ) )
=−∑ ∑ P(x i , x )
j (i ) log + log P ( x i −H ( X ) =
)
i =1 xi , x j ( i ) P ( x j (i ) ) P ( x i )
n n
= − ∑ I ( X i , X j ( i ) ) − ∑ ∑ P ( x i ) log P ( xi ) −H ( X ).
i =1 i =1 xi
The last two terms are independen t of the choice of the tree, and thus D ( P , P ' )
is minimized by maximizing the sum of edge weights I ( X i , X j ( i ) ).
Chow-Liu algorithm
[As presented in Pearl, 1988]
1. From the given distribution P(x) (or from data generated by P(x)),
compute the joint distributionP( xi | x j ) for all i ≠ j
2. Using the pairwise distributions from step 1, compute the mutual
information
I(Xi ; X j ) for each pair of nodes and assign it as the
weight to the corresponding edge( X i , X j ) .
3. Compute the maximum-weight spanning tree (MSWT):
a. Start from the empty tree over n variables
b. Insert the two largest-weight edges
c. Find the next largest-weight edge and add it to the tree if no cycle is
formed; otherwise, discard the edge and repeat this step.
d. Repeat step (c) until n-1 edges have been selected (a tree is
constructed).
4. Select an arbitrary root node, and direct the edges outwards from
the root.
5. Tree approximation P’(x) can be computed as a projection of P(x) on
the resulting directed tree (using the product-form of P’(x)).
Summary:
Learning and inference in BNs
Bayesian Networks – graphical probabilistic models
Efficient representation and inference
Expert knowledge + learning from data
Learning:
parameters (parameter estimation, EM)
Complexity trade-off: