Help me with python code:
Alarm Consider the scenario from our week 4 tutorial: You have an intruder's alarm in your house. This alarm may go off because of an intruder, or because of an earthquake near your place. Your neighbour Mr Wilson, who is overly paranoid, may hear your alarm. Similarly, your other neighbour Mrs Jones, who lives further from the house, may hear your alarm. Let the variables alarm (A), earthquake (E), intruder (I), Mr Wils0n (W), and Mrs Jones (J) denote whether the alarm went off; an earthquake happened; there is an intruder at your house; Mr Wilson has heard the alarm; and Mrs Jones has heard the alarm, respectively, with A, E, I, W, J E {0, 1}. We model the joint distribution of these variables as follows: P(E, I, A, W, J) = P(E)P(I)P(A|E, I)P(W|A)P(J|A). The conditional probability tables (CPTs) that fully determine the above scenario are: P(E = 1) = 10-6 P(I = 1) = 0.01 P(A:1|I=1,E=0)=0.99 P(A:1|I=0,E:1)=0.99 P(A: 1|I= 1,13: 1) 20.9999 P(A: 1|I=0,E=0) =10-4 P(W: 1|A: 1) 20.95 P(W: 1|A:O):0.2 P(J = 1|A = 1) = 0.8 P(J = 1|A = 0): 0.05 Your task is to model the above in python, using the pgmpy library. You can also use pomegranate or plain numpy instead of pgmpy, if you prefer. 1. Using the library of your choice, model the above Bayesian Network. Just using Tabu- larCPDs is an acceptable solution. Submit the (complete) code 1 point. 2. Compute joint probabilities P(I, W). Submit a full table and the (additional) code to compute the table 1 point. 3. Compute joint probabilities P(I, J) Submit a full table and the code to compute the table 1 point. 4. Compute the conditional probability table for P(I|W) Submit the table and the code to compute the table 1 point. 5. Compute the conditional probability table for P(I|J) Submit the table and the code to compute the table 1 point. To compute the probabilities, you can use factorisation, marginalisation, and possibly reduce and normalise CPD tables. Using builtin methods for variable elimination is also acceptable