LM42, LM43 - Exact Inference in Bayesian Networks
LM42, LM43 - Exact Inference in Bayesian Networks
Purpose of inferences:
•The basic task for any probabilistic inference system is to compute the posterior
probability distribution for a set of query variables, given some observed event - that
Notations:
•X The query variable.
•E The set of evidence variables E1, . . . ,Em.
•e Particular observed event.
•Y The non-evidence, non-query variables Y1, . . . , Yn(called the hidden variables).
•Thus, the complete set of variables is X={X}∪E ∪Y.
•A typical query asks for the posterior probability distribution P(X | e).
Inferences:
•Inference by Enumeration
Inference by Enumeration:
•Any conditional probability can be computed by summing terms from the full joint
distribution.
•A query P(X | e) can be answered using Equation:
Inference by Enumeration:
Inference by Enumeration:
•The hidden variables for this query are Earthquake and Alarm. (Y1 and Y2).
Inference by Enumeration:
•Using initial letters for the variables to shorten the expressions, we have:
•The semantics of Bayesian networks gives us an expression in terms of CPT entries. For
Inference by Enumeration:
•The P(b) term is a constant and can be moved outside the summations over a and e, and the
P(e) term can be moved outside the summation over a. Hence, we have
•The evaluation process for the expression in Equation (14.4) is shown as an expression tree in
Figure 14.8.
Inference by Enumeration:
Inference by Enumeration:
•Note that the tree in Figure 14.8 makes explicit the repeated subexpressions evaluated by the
algorithm.
•The products P(j | a) P(m| a) and P(j | ¬a) P(m| ¬a) are computed twice, once for each value
of e.
•A general method, the variable elimination algorithm avoids such wasted computations.
•The idea is simple: do the calculation once and save the results for later use. This is a form of
dynamic programming.
•One of such kind of approach is, the variable elimination algorithm, which is the simplest.
•Intermediate results are stored, and summations over each variable are done only for those
•Let us illustrate this process for the burglary network. We evaluate the expression:
•We have annotated each part of the expression with the name of the corresponding factor; each
•For example, the factors f4(A) and f5(A) corresponding to P(j | a) and P(m| a) depend just on A
because J and M are fixed by the query. They are therefore two-element vectors:
•where the “×” operator is not ordinary matrix multiplication but instead the pointwise
AL3391/AI/II AI&DS/III SEM/KG-KiTE
product operation.
EXACT INFERENCES IN BAYESIAN NETWORKS
union of the variables in f1 and f2 and whose elements are given by the product of the
corresponding elements in the two factors.
•Suppose the two factors have variables Y1, . . . , Yk in common. Then we have:
•If all the variables are binary, then f1 and f2 have 2j+k and 2k+l entries, respectively, and the
pointwise product has 2j+k+l entries.
•For example, given two factors f1(A,B)AL3391/AI/II
and f2AI&DS/III
(B,C), the pointwise product f1 ×f2 = f3(A,B,C)
SEM/KG-KiTE
EXACT INFERENCES IN BAYESIAN NETWORKS
•Notice that the factor resulting from a pointwise product can contain more variables than any
of the factors being multiplied and that the size of a factor is exponential in the number of
variables. AL3391/AI/II AI&DS/III SEM/KG-KiTE
EXACT INFERENCES IN BAYESIAN NETWORKS
•Summing out a variable from a product of factors is done by adding up the submatrices formed
•Evaluating this expression from right to left, we notice something interesting: ⅀m P(m| a) is
equal to 1 by definition!
•Hence the variable M is irrelevant to this query; the result of the query P(JohnCalls |
Burglary =true) is unchanged if we remove MaryCalls from the network altogether.
AL3391/AI/II AI&DS/III SEM/KG-KiTE
EXACT INFERENCES IN BAYESIAN NETWORKS
•In general, we can remove any leaf node that is not a query variable or an evidence variable.
•After its removal, there may be some more leaf nodes, and these too may be irrelevant.
•Continuing this process, we eventually find that every variable that is not an ancestor of a
•A variable elimination algorithm can therefore remove all these variables before evaluating the
query.
•The complexity of exact inference in Bayesian networks depends strongly on the structure of
the network.
•The burglary network of Figure 14.2 belongs to the family of networks in which there is at
most one undirected path between any two nodes in the network.
•These are called singly connected networks or poly trees, and they have a particularly nice
property: The time and space complexity of exact inference in poly trees is linear in the size of
Summary: