Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume a Bayesian belief network with the Naive-Bayes structure for a simplified version of the pneumonia problem (see figure below) The variable Pneumonia is

image text in transcribedimage text in transcribed

Assume a Bayesian belief network with the Naive-Bayes structure for a simplified version of the pneumonia problem (see figure below) The variable Pneumonia is at the root of the Naive Bayes network and features (attributes) Fever, Paleness, Cough and HighWBC are conditionally indepen- dent given Pneumonia. Assume that random variables in our model are discrete with the following set of values: Pneumonia: True, False Fever: True, False Paleness: True, False Cough: True, False HighWBC: True, False Pneumonia Fever Paleness) Cough High WBC Part a. Write and submit a program PD learning.py that takes the data in the file 'pneumonia.csv', learns the ML estimates of parameters of the BBN network, reports the BBN parameters and finally saves the learned network. You can use different formats to save the BBN model using either json format or pickle libraries. Please make sure you know how to recover (load) the model back from the file. The pneumonia file given to you includes 500 examples (in rows). The features are in columns, in the following order: Fever, Paleness, Cough, HighWBC. Last column represents Pneumonia variable. The data are represented such that True corresponds to 1 and False to 0. Report the parameters of the network in your report. You can use different formats to save the BBN model: json format, pickle or others. Please make sure you know how to recover (load) the model back from the file (see below). Part b. Assume that the patient comes with the following set symptoms: Fever and Cough are true; Paleness and HighWBC are false. What is the probability P(Pneumonia = T|Fever = T, Paleness = F,Cough T, HighW BCF), that is, the probability that the patient suffers from Pneumonia, given the symptoms? Simplify the expression as much as possible before plugging in the values. Part c. Assume that the patient reports Cough and a Fever (they are true); and values of Paleness and High WBC are not known. Compute the probability P(Pneumonia =T|Fever = T, Cough T) of the patient suffering from the pneumonia, given the symptoms? Simplify the expression as much as possible before plugging in the numbers. Part d. Write and submit a Python program PD.inference.py that reads the previously saved BBN model, a combination of patient symptoms (the values of Fever, Paleness, Cough, HighWBC) from the file Example.csv and computes the probability of P(Pneumonia = True|Current Symptoms). The values of symptoms for the current patient case are given in the following order: Fever, Paleness, Cough, HighWBC. The values are encoded as follows: 0 for False, 1 for True, and -1 for not given (not known). For example, the symptoms of the patient case in part b are encoded as a vector of 4 values: (1010). and symptoms in part c as: (1 -11 -1). Note: Please note that your program should work on an arbitrary combination of input values in the example file.

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_2

Step: 3

blur-text-image_3

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

Applied Linear Algebra

Authors: Peter J. Olver, Cheri Shakiban

1st edition

131473824, 978-0131473829

More Books

Students also viewed these Mathematics questions

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago

Question

Please provide code in PYTHON.

Answered: 1 week ago