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,YZ)=P(XZ)P(YZ)

then it follows that

P(XY,Z)=P(XZ)

Since P(X,YZ)=P(XZ)P(YZ)

P(XZ)=P(X,YZ)P(YZ)P(X,YZ)P(YZ)=P(X,YZ)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:

    • (QR|L)I(P)

    • (TL|R,Q)I(P)

    • (SR,L|T,Q)I(P)

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

P(t)=Qq,qc,Rr,rcP(tQ,R)P(Q,R)P(t)=P(T=tQ=q,R=r)P(Q=q,R=r)+P(T=tQ=q,R=rc)P(Q=q,R=rc)+P(T=tQ=qc,R=r)P(Q=qc,R=r)+P(T=tQ=qc,R=rc)P(Q=qc,R=rc)P(Q,R)=Ll,lcP(Q,L,R)=Ll,lcP(QL)P(LR)P(R)P(t)=Qq,qc,Rr,rc[P(tQ,R)×(Ll,lcP(QL)P(LR)P(R))]P(t)=P(r)[P(tq,r)l{l,lc}P(ql)P(lr)+P(tqc,r)l{l,lc}P(qcl)P(lr)]+P(rc)[P(tq,rc)l{l,lc}P(ql)P(lrc)+P(tqc,rc)l{l,lc}P(qcl)P(lrc)]=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.143800.9688