The submission for this homework should be a single PDF file containing all of the relevant code, figures, and any text explaining your results. When coding your answers, try to write functions to encapsulate and reuse code, instead of copying and pasting the same code multiple times. This will not only reduce your programming efforts, but also make it easier for us to understand and give credit for your work. Show and explain the reasoning behind your work! Problem 1: Conditional Independence (30 points) Consider the Bayesian network graph from Example 3-5 (shown at right.) (a) Draw the Markov random field corresponding to this Bayesian network’s factorization. (10 points) Note: If you want to draw using networkx , you may find the following node positions helpful: 1 n=['A','B','C','D','E','F','G','H','J','K'] 2 x=[5.5, 2.1, 4.9, 6.8, 7.9, 7.3, 4.0, 2.0, 4.0, 6.4] 3 y=[10.3, 10.0, 9.4, 9.9, 9.9, 8.6, 8.3, 7.0, 7.0, 7.1] 4 pos = {ni:(xi,yi) for ni,xi,yi in zip(n,x,y)} (b) We saw three conditional independence relationships held in the Bayesian network: (1) B is (marginally) independent of E (2) B is independent of E given F (3) B is independent of E given H, K, and F Which of these can also be verified from the Markov random field graph? Explain. (10 points) (c) One way to convert an undirected graph to a Bayesian network is to first select a chain rule expansion order, then test for conditional independence when selecting the required parents along that order. Follow this procedure to select the parents for A, B, C, D, E in that order (i.e., stop at this point, without bothering to compute the parents for later variables), using only the undirected Markov graph you computed in part (1) to determine conditional independence. How many more edges have you added than are present for the parents of those variables in the original graph? (10 points) Problem 2: ProbLog (35 points) In this problem we will construct and evaluate a simple probabilistic model using the first-order language ProbLog1 . You can find documentation on the language itself at https://dtai.cs.kuleuven.be/problog/, and can run models either locally in Python using pip install problog and https://dtai.cs.kuleuven.be/problog/tutorial/advanced/01_python_interface.html, or in the cloud using their online interpreter at https://dtai.cs.kuleuven.be/problog/editor.html. It may be helpful for this problem to look at the syntax for the friends-smokers model, https://dtai.cs.kuleuven.be/problog/tutorial/basic/05_smokers.html 1 I would have liked to use the more undirected language of Markov logic, but the tools appear considerably less elegant than ProbLog, so, here we are. Homework 3 UC