











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












This assignment is due on Friday, November 19, 2004. The assignment is again somewhat longer than the previous two assignments; therefore, you are advised to start working on it immediately. Each problem is equally weighted. As always, show all works.
Consider the following Bayesian Network, where variables A-E are all Boolean- valued:
(A) What is the probability that all five of these Boolean variables are simultane- ously true?
(B) What is the probability that all five of these Boolean variables are simultane- ously false?
(C) What is the probability that A is false given that the four other variables are all known to be true?
Solution:
(A) For this problem, we need to evaluate the probability P (a = T, b = T, c = T, d = T, e = T ). Because P (a, b, c, d, e) = P (a)P (b)P (c)P (d|a, b)P (e|b, c), we have
P (a, b, c, d, e) = P (a)P (b)P (c)P (d|a, b)P (e|b, c) = 0. 2 × 0. 5 × 0. 8 × 0. 1 × 0. 3 = 0. 0024
(B) Similarly, we have
P (¬a, ¬b, ¬c, ¬d, ¬e) = P (¬a)P (¬b)P (¬c)P (¬d|¬a, ¬b)P (¬e|¬b, ¬c) = 0. 8 × 0. 5 × 0. 2 × 0. 1 × 0. 8 = 0. 0064
(C) For this part, we need to calculate P (a = F |b = c = d = e = T ). However, P (a = F |b = c = d = e = T ) = αP (a = F, b = c = d = e = T ) and P (a = T |b = c = d = e = T ) = αP (a = T, b = c = d = e = T ) for some constant α. Note that α is here to ensure that 1 = P (a = F |b = c = d = e = T ) + P (a = T |b = c = d = e = T ). The joint probabilities P (a = T, b = c = d = e = T ) and P (a = F, b = c = d = e = T ) can be computed using the formula P (a, b, c, d, e) = P (a)P (b)P (c)P (d|a, b)P (e|b, c) :
P (¬a|b, c, d, e) = αP (¬a)P (b)P (c)P (d|¬a, b)P (e|b, c) = α × 0. 8 × 0. 5 × 0. 8 × 0. 6 × 0. 3 = α × 0. 05760 P (a|b, c, d, e) = αP (a)P (b)P (c)P (d|a, b)P (e|b, c) = α × 0. 2 × 0. 5 × 0. 8 × 0. 1 × 0. 3 = α × 0. 00240
This implies that α = 1/ 0. 06 and P (¬a|b, c, d, e) = 0. 96.
P (F ake|headsk) = αP (headsk|F ake)P (F ake) = α < 1. 0 , 0. 5 k^ >< 1 /n, (n − 1)/n > = α < 1 /n, (n − 1)/ 2 kn > = < 2 k/(2k^ + n − 1), (n − 1)/(2k^ + n − 1) >
(3) The procedure makes an error if and only if a fair coin is chosen and we get heads k times in a row. The probability of this is P (headsk|¬f ake)P (¬f ake) = (n − 1)/ 2 kn.
(A) Bayes’ Rule gives
P (H|e 1 , e 2 ) =
P (e 1 , e 2 |H)P (H) P (e 1 , e 2 )
Thus the information in (ii) is sufficient–in fact, we don’t need P (e 1 , e 2 ) be- cause we can use normalization. Intuitively, the information in (i) is insuffi- cient because P (e 1 |H) and P (e 2 |H) provide no information about correlations between e 1 and e 2 that might be induced by H. More specifically, we can re- duce the P (e 1 , e 2 |H) in the equation above to P (e 1 |H, e 2 )P (e 2 |H). Obviously, without extra information such as independence assumptions, P (e 1 |H) doesn’t give us enough information to compute P (e 1 |H, e 2 ). Mathematically, suppose H has m possible values and e 1 and e 2 have n 1 and n 2 possible, respectively. P (H|e 1 , e 2 ) contains (m − 1)n 1 n 2 independent parameters, whereas P (e 1 , e 2 ) contains (n 1 n 2 −1) independent parameters, P (H) conains (m−1) indepen- dent parameters, P (e 1 |H) contains m(n 1 − 1) independent parameters, and P (e 2 |H) contains m(n 2 −1) independent paramaters. Hence, the information in (i) contains (n 1 n 2 − 1) + (m − 1) + m(n 1 − 1) + m(n 2 − 1) numbers insufficient for large m, n 1 , and n 2. By the same token, the information in (iii) is also insufficient. A com- mon error is to compare the number of independent parameters in the information given, to the number of parameters needed to specify the joint, rather than to the generally smaller number of parameters needed to specify P (H|e 1 , e 2 ). Requiring that we have enough parameters to specify the joint is excessive and may lead us
to discard actual solutions. As a simple example, suppose we want to compute P (e 1 , H), where all the variables are boolean. P (e 1 |H) and P (H) are obviously sufficient, although together they only contain three independent parameters be- tween them, less than the seven required to specify the joint P (e 1 , e 2 , H). (B) If P (e 1 |H, e 2 ) = P (e 1 |H), then e 1 and e 2 are conditionally independent given H, and the equation above simplifies to
P (H|e 1 , e 2 ) =
P (e 1 |H)P (e 2 |H)P (H) P (e 1 , e 2 )
Obviously, both (i) and (ii) are now sufficient. Moreover, (iii) has also become sufficient because we can use normalization to compute P (e 1 , e 2 ). More specifi- cally, for any values of e 1 , e 2 of e 1 and e 2 , respectively, the marginal probability of this pair is
P (e 1 , e 2 ) =
h∈dom(H)
P (e 1 , e 2 |h)P (h)
h∈dom(H)
P (e 1 |h)P (e 2 |h)P (h).
We already have each of the values needed for this computation.
(1) (ii) and (iii) are the correct networks. Obviously, N depends conditionally on both M 1 and F 1 as well as M 2 and F 2. That is, P (N |M 1 , M 2 , F 1 , F 2 ) can NOT be simplified to only P (N |M 1 , M 2 ). The latter is what you have from network (i).
(2) (ii) is the better network. For one thing, we have fewer number of links and hence, fewer CPTs. (3) There are many possible way, I suppose, to fill the CPT. As long as you do make sure that all rows sum up to 1. Without knowing the true values of e and f , all row sums should be the same. One possible result is
N \M 1 0 1 2 3 4 1 e(1 2 − f^ )+ f (1 − e)(1 − f ) e(1 2 − f^ ) 0 0 2 f e(1− 2 f^ ) (1 − e)(1 − f ) e(1− 2 f^ ) 0 3 f 0 e(1 2 − f^ ) (1 − e)(1 − f ) e(1− 2 f^ )
Note that all row sums are equal. (4) Without any constraint on the values of N , N can be 2 , 4 or any integer greater than 5. (5) Although we do not know the values of e and f , however, we do know from the problem that e >> f. This is all we need to show that N = 2 is the most likely result. First, we know that N can only be 2 , 4 and N ≥ 6. N = 2 means that each telescope must have made a mistake (either under or over-count the stars). The
probability of this e
(^2) (1−f ) 2 4 , assuming (as is obvious) that the mistakes from both telescopes are made independently. The probability for N = 4 is e(1− 2 f )f and for
N ≥ 6 , the probability if f 2. Because e >> f , we can assume that e(1 2 − f^ ) > f , and therefore, the probability for N = 2 is greater than that of N = 4. Clearly, the probability of N ≥ 6 is f 2 which can be regarded as negligible.
Consider the network shown in Figure 14.19(ii), and assume that the two tele- scopes work identically. N ∈ { 1 , 2 , 3 } and M 1 , M 2 ∈ { 0 , 1 , 2 , 3 , 4 }, with the symbolic CPTs as described in Exercise 14.3. Using the enumeration algorithm, calculate the probability distribution P (N |M 1 = 2, M 2 = 2).
Figure 2: Figure 14.19: Three possible networks for the telescope problem.
Solution: To calculate P (N |M 1 = 2, M 2 = 2), we use the fact that P (N |M 1 = 2, M 2 =
P (N |M 1 = 2, M 2 = 2) = αP (N, M 1 = 2, M 2 = 2) = α
f 1 ,f 2
P (N, M 1 = 2, M 2 = 2, F 1 = f 1 , F 2 = f 2 ).
We assume that the prior P (N ) is uniform, so P (n) = 1/ 3. The joint probability P (N, M 1 = 2, M 2 = 2, F 1 = f 1 , F 2 = f 2 ) can be factored, according to the Bayesian Network as
P (N, M 1 = 2, M 2 = 2, F 1 = f 1 , F 2 = f 2 ) = P (M 1 = 2|F 1 = f 1 , N )P (M 2 = 2|F 2 = f 2 , N )P (F 1 = f 1 )P (F 2 = f 2 )P (N ).
Consider the family of linear Gaussian networks, as illustrated on page 502.
Solution: (A) For the general Gaussian (and linear Gaussian) distribution (page 982), we have
P (X 1 ) = N (μ 1 , σ^21 )(x 1 ) =
2 πσ 1
e
− (x^1 −μ^1 ) 2 2 σ^21
and
P (X 2 |X 1 ) = N (ax 1 + μ 2 , σ 2 )(x 2 ) =
2 πσ 2
e
− (x^2 −ax 2 σ^12 −μ^2 )^2 2
For simplicity, we can assume that μ 1 and μ 2 are zero. This does not change problem. We then have
2 πσ 1 σ 2
e
−( (x^1 ) 2 2 σ^21 +^
(x 2 −ax 1 )^2 2 σ^22 )
What the problem ask us to do is to come up with a 2 -by- 2 matrix Σ, such that (for some constant C),
P (X 1 , X 2 ) = Ce−^
1 2 (xtΣ−^1 x)
where x = [x 1 x 2 ]t^ is a 2 -by- 1 vector and xt^ is the transpose of x. However, from the above, we have (for some constant C)
P (X 1 , X 2 ) = Ce
− 12 ( x (^21) σ^21 +^
x^22 σ^22 −^2
x 1 x 2 a σ^22 +^
a^2 x^21 σ^22 )
With this, it is easy to see what Σ−^1 has to be: Σ−^1 =
1 σ 12 +^
a^2 σ 22 −^
a σ 22 − (^) σa 2 2
1 σ^22
because
−^12 xtΣ−^1 x equals −^12 ( x
(^21) σ^21 +^
x^22 σ 22 −^2
x 1 x 2 a σ^22 +^
a^2 x^21 [ σ^22 ). This, of course, implies^ Σ = σ^21 aσ 12 aσ^21 σ^22 + a^2 σ^21
(B) This part is entirely similar to the previous part although it is somewhat tedious to write out the entire derivation. So do excuse me from doing so. You will not be responsible for the proof of this problem for the final. However, you are expected to know the result.
Consider the problem of generating a random sample from a specified distribution on a single variable. You can assume that a random number generator is available that returns a random number uniformly distributed between 0 and 1.
Solution: (1) Let Pj be the possibility that X = xj. Then P 1 = p 1 , Pj = Pj− 1 + pj for j > 1. This will take O(K) time. To sample it, we can generate one random number x and see which regions [PiPi+1] it is in. Suppose x ∈ [Pj− 1 Pj ] then the corresponding sample would be xj. If k is large, the operation is dominated by locating which region x is in. However, this can be done in O(logk) if you sort the numbers P 1 , · · · , Pk correctly, for instance, in a heap.
(B) The simplest thing is to produce samples according to the probability pi. That is, we generate N pi samples for xi. Since N >> k, these will be samples drawn from P. Now, let’s look at operation count. We need some small amount w of
In this exercise, we examine what happens to the probabilities in the umbrella world in the limit of long time sequences.
Figure 3: Network for Rain-Umbrella Example
Solution: (1) Let’s suppose P (Rt|u 1 , · · · , ut) =< a, b > (of course, a + b = 1). First thing we need to figure out is how does P (Rt|u 1 , · · · , ut) relate to P (Rt+1|u 1 , · · · , ut, ut+1). We have
P (Rt+1|u 1 , · · · , ut, ut+1) = αP (ut+1|Rt+1)P (Rt+1|u 1 , · · · , ut)
= αP (ut+1|Rt+1)
rt
P (Rt+1|rt)P (rt|u 1 , · · · , ut)
= α < 0. 9 , 0. 2 > ∗(< 0. 7 , 0. 3 > a+ < 0. 3 , 0. 7 > ∗(1 − a)) = α < 0 .27 + 0. 36 a, 0. 14 − 0. 08 a >
= <
0 .27 + 0. 36 a 0 .41 + 0. 28 a
since from the penultimate equality we have α = (^0) .41+0^1. 28 a. To calculate the fixed point, we simply have to solve for a in:
0 .27 + 0. 36 a 0 .41 + 0. 28 a
= a.
This is a quadratic equation in a and there are two roots, 0. 8967 and − 1. 0753. We all know which one should be the answer.
(2) This part is very similar to the previous part. We want to know how does P (R2+k|U 1 , U 2 ) relate to P (R2+k+1|U 1 , U 2 ). Again, suppose P (R2+k|U 1 , U 2 ) =< a, b >. Then,
P (R2+k+1|U 1 , U 2 ) =
r2+k
P (R2+k+1|r2+k)P (r2+k|U 1 , U 2 )
= < 0. 7 , 0. 3 > a+ < 0. 3 , 0. 7 > (1 − a) = < 0 .3 + 0. 4 a, 0. 7 − 0. 4 a >
From this, we can compute all P (R2+k|U 1 , U 2 ) for k ≥ 1 once we know P (R 2 |U 1 , U 2 ). The latter is on page 544. However, we do not need this result. To find the fixed point, i.e. P (R2+k+1|U 1 , U 2 ) = P (R2+k|U 1 , U 2 ), we have a = 0.3 + 0. 4 a. Con- veniently, we have 0. 6 a = 0. 3 and a = 0. 5.
Figure 4: Figure 15.22: A Bayesian network representation of a switching Kalman filter. The switching variable St is a discrete state variable whose value determines the transition model for the continuous state variables Xt. For any discrete state i, the transition model P (Xt+1|Xt, St = i) is a linear Gaussian model, just as in a regular Kalman filter. The transition model for the discrete state, P (St+1|St), can be thought of as a matrix, as in a hidden Markov model.
Solution: (A) We have P (X 1 ) =
si P^ (si)^
X 0 P^ (X^1 |x^0 , si)dx^0.^ Since the transitional model P (Xt+1|Xt, St = i) is a linear Gaussian model, the expression above shows that P (X 1 ) is a mixture of Gaussian with weights P (si), whose sum is obviously
(B) This is again almost trivial if you know the following formulas:
P (Xt+1|e1:t+1) = α
j=
P (et+1|Xt+1, St = j)P (Xt+1|e1:t)P (St = j)
and
P (Xt+1|e1:t) =
xt
P (Xt+1|xt)P (xt|e1:t)
The last equation shows that P (Xt+1|e1:t) is a mixture of m Gaussians because P (Xt|e1:t) is a mixture of m Gaussians and the fact that the products of Gaussians as well as marginalizations of Gaussians are all Gaussians. The first equation then
implies that P (Xt+1|e1:t+1) is a mixture of km Gaussians. Notice that, this result shows the complexity of the inference process for non-Gaussian filters. At each time step, we are increasing the mixture components by a factor of k, from m to km. The problem is generally intractable because of this geometrical growth of number of mixture components.
(c, r) (c, ¬r) (¬c, r) (¬c, ¬r) (c, r) 17 / 27 5 / 54 5 / 18 0 (c, ¬r) 11 / 27 22 / 189 0 10 / 21 (¬c, r) 2 / 9 0 59 / 153 20 / 51 (¬c, ¬r) 0 1 / 42 11 / 102 310 / 357
(c) Q^2 represents the probability of going from each state to each state in two steps. (d) Qn^ (as n → ∞) represents the long-term probability of being in each state starting in each state; for ergodic Q these probabilities are independent of the start- ing state, so every row of Q is the same and represents the posterior distribution over states given the evidence. (e) We can produce very large powers of Q with very few matrix multiplica- tions. For example, we can get Q^2 with one multiplication, Q^4 with two, and Q^2
k
with k. Unfortunately, in a network with n Boolean variables, the matrix is of size 2 n^ × 2 n, so each multiplication takes O(2^3 n) operations.