Skip to content
PostBayesian Network / Assignment

Bayesian-As-1

2025-10-11
Back to Blog

BN-Assignment-1 ​

Question 1. ​

Given X, Y and Z are 3 sets of random variables. Prove if

P(X,Y∣Z)=P(X∣Z)P(Y∣Z)

then it follows that

P(X∣Y,Z)=P(X∣Z)

Since P(X,Y∣Z)=P(X∣Z)P(Y∣Z)

P(X∣Z)=P(X,Y∣Z)P(Y∣Z)P(X,Y∣Z)P(Y∣Z)=P(X,Y,Z)P(Z)P(Y,Z)P(Z)=P(X,Y,Z)P(Y,Z)=P(X,Y|Z)

Question 2. ​

Consider the following Bayesian networks with the following nodes

  • R (Rain): it is raining or not, with binary values r: it is raining and rc: it is not raining. val(R)={r,rc}
  • L (Leaves): there are juicy leaves or not, val(L)={l,lc}
  • Q (Quokkas Happiness): the quokkas are happy or unhappy, val(Q)={q,qc}
  • T (Tourists): there are lots of tourists or not many, val(T)={t,tc}
  • S (Selfie Quokka): people are taking lots of quokka selfies, or not, val(S)={s,sc}
zDQc9h
  1. According to the given Bayesian network, factorize the joint distribution P(R,L,Q,T,S)Solution:
P(R,L,Q,T,S)=P(R)P(L|R)P(Q|L,R)P(T|Q,L,R)P(S|T,Q,L,R)=P(R)P(L|R)P(Q|L)P(T|Q,R)P(S|T,Q)
  1. Specify all the conditional independencies encoded in this Bayesian network. Solution:

    • (Q⊥R|L)∈I(P)

    • (T⊥L|R,Q)∈I(P)

    • (S⊥R,L|T,Q)∈I(P)

  2. What is the probability that there are lots of tourists? Solution:

P(t)=∑Q∈q,qc,R∈r,rcP(t∣Q,R)P(Q,R)P(t)=P(T=t∣Q=q,R=r)P(Q=q,R=r)+P(T=t∣Q=q,R=rc)P(Q=q,R=rc)+P(T=t∣Q=qc,R=r)P(Q=qc,R=r)+P(T=t∣Q=qc,R=rc)P(Q=qc,R=rc)P(Q,R)=∑L∈l,lcP(Q,L,R)=∑L∈l,lcP(Q∣L)P(L∣R)P(R)P(t)=∑Q∈q,qc,R∈r,rc[P(t∣Q,R)×(∑L∈l,lcP(Q∣L)P(L∣R)P(R))]P(t)=P(r)[P(t∣q,r)∑l∈{l,lc}P(q∣l)P(l∣r)+P(t∣qc,r)∑l∈{l,lc}P(qc∣l)P(l∣r)]+P(rc)[P(t∣q,rc)∑l∈{l,lc}P(q∣l)P(l∣rc)+P(t∣qc,rc)∑l∈{l,lc}P(qc∣l)P(l∣rc)]=0.2×(0.504+0.098+0.016+0.012)+0.8×(0.243+0.009+0.063+0.441)=0.7308
  1. What is the probability that the quokkas are happy, given there are lots of quokka selfies being taken and it is raining? Solution:
P(Q=q|S=s,R=r)=P(Q=q,S=s,R=r)P(S=s,R=r)P(Q=q,S=s,R=r)=∑L∈{l,lc}∑T∈{t,tc}P(r)P(L|r)P(q|L)P(T|q,r)P(s|q,T)=∑T∈{t,tc}P(r)P(l|r)P(q|l)P(T|q,r)P(s|q,T)+∑T∈{t,tc}P(r)P(lc|r)P(q|lc)P(T|q,r)P(s|q,T)= P(r)P(l|r)P(q|l)P(t|q,r)P(s|q,t)+P(r)P(l|r)P(q|l)P(tc|q,r)P(s|q,tc)+P(r)P(lc|r)P(q|lc)P(t|q,r)P(s|q,t)+P(r)P(lc|r)P(q|lc)P(tc|q,r)P(s|q,tc)= 0.2×0.8×0.9×0.7×0.9+0.2×0.8×0.9×0.3×0.6+0.2×0.2×0.7×0.7×0.9+0.2×0.2×0.7×0.3×0.6=0.09072+0.02592+0.01764+0.00504=0.13932P(S=s,R=r)=P(Q=q,S=s,R=r)+P(Q=qc,S=s,R=r)=0.13932+P(Q=qc,S=s,R=r)=0.13932+∑L∈{l,lc}∑T∈{t,tc}P(r)P(L|r)P(qc|L)P(T|qc,r)P(s|qc,T)=0.13932+0.00448=0.14380P(Q=q|S=s,R=r)=P(Q=q,S=s,R=r)P(S=s,R=r)=0.139320.14380≈0.9688