Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding Style: define a function for each question. please use python - 3 And plase make sure the code compiles this is my third time

Coding Style: define a function for each question. please use python-3
And plase make sure the code compiles this is my third time posting this question because the answer given do not compile. Use the latest version of all the libraries please and python 3.11
Given the Bayesian Networks Inference example discussed in the class, answer the following questions.
1) The class example includes four random variables: Rain, Maintenance, Train and Appointment. Their dependency relations are: Maintenance depends on Rain, Train depends on Rain and Maintenance, Appointment depends on Train. Construct the Bayesian network and visualize it.(Tip: you can use pgmpy, pomegranate or any popular Python library to construct the Bayesian network, and use matplotlib or other library to visualize the network structure).
2) Based on the constructed Bayesian network, make the following inferences: (1) P (Rain=heavy,
Maintenance=yes),(2) P(Appointment=attend | Rain=none, Maintenance=no)
2
3) Suppose the probability of attending or missing todays Appointment is not dependent on Train, but
only dependent on yesterdays Appointment. Given the initial state [1,0] as the probability
distribution of attend and miss, and the transition matrix P =[[0.9,0.1],[0.5,0.5]], what is the
probability distribution of attend and miss ten days later? (Tip: Simulate the Markov chain over n
steps).
Conditional Probability Tables used for 1) and 2):
P(Rain)=(
"none": 0.7,
"light": 0.2,
"heavy": 0.1
)
P(Maintenance| Rain)=([
["none", "yes", 0.4],
["none","no",0.6],
["light", "yes", 0.2],
["light","no",0.8],
["heavy", "yes", 0.1],
["heavy","no",0.9]
])
P(Train | Rain, Maintenance)=([
["none", "yes", "on time", 0.8],
["none", "yes", "delayed", 0.2],
["none","no","on time", 0.9],
["none","no", "delayed", 0.1],
["light", "yes", "on time", 0.6],
["light", "yes", "delayed", 0.4],
["light","no","on time", 0.7],
["light","no", "delayed", 0.3],
["heavy", "yes", "on time", 0.4],
["heavy", "yes", "delayed", 0.6],
["heavy","no","on time", 0.5],
["heavy","no", "delayed", 0.5],
])
P(Appointment)=([
["on time", "attend", 0.9],
["on time", "miss", 0.1],
["delayed", "attend", 0.6],
["delayed", "miss", 0.4]
])
the transition matrix used for 3):
P = $0.90.1
0.50.5*
It means P(attend -> attend)=0.9, P(attend -> miss)=0.1, P(miss ->
attend)=0.5, P(miss -> miss)=0.5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions