Assignment 3

Bayesian Networks

Max possible score:

Task 1

Max: [4308: 50 Points, 5360: 50 Points]

Consider the following Bayesian Network

BayesianNetwork from Quiz4 Prep material
Image 1: A Bayesian Network

The Variables used here are as followes
Let us say you are given some Training Data which represents what happens over a period of time (For example: This file contains what happens every evening over one specific year). Your Task is to learn the conditonal probabilty tables for the bayesian network from the training data. The training data will be formatted as follows:
Your program should be called bnet and the command line invocation should follow the following format:

bnet.py <training_data>
You can display the calculated probabilty values in standard output.


Task 2

Max: [4308: 25 Points, 5360: 25 Points]

Add functionality to the code for Task 1 to also be able to calculate any value in the JPD for this domain using the conditional probabilty distributions calculated in Task 1. [Note: Correct implementation of this section will also give credit for Task 1]

Your program's command line invocation will be changed to:

bnet.py <training_data> <Bt/Bf> <Gt/Gf> <Ct/Cf> <Ft/Ff>
Sample Invocation: bnet.py training_data.txt Bt Gf Ct Ff  Train the Bayesian Network and use it to calculate P(B=t, G=f, C=t, F=f)

You can display the calculated probabilty values in standard output.


Task 3 [Optional Extra Credit]

Max: [4308: 25 Points, 5360: 25 Points]

Add functionality to the code for Task 2 to also be able to calculate the probabilty for any event given evidence (if available) using inference by enumeration. [Note: Correct implementation of this section will also give credit for Task 1 and 2]

Your program's command line invocation will be changed to:

bnet.py <training_data> <query variable values> [given <evidence variable values>]
Sample Invocations:
You can display the calculated probabilty values in standard output.


How to submit

Implementations in C, C++, Java, and Python will be accepted. Points will be taken off for failure to comply with this requirement unless previously cleared with the Instructor.

Create a ZIPPED directory called <net-id>_assmt2.zip (no other forms of compression accepted, contact the instructor or TA if you do not know how to produce .zip files).
The directory should contain the source code for the task (no need for any compiled binaries). Each folder should also contain a file called readme.txt, which should specify precisely: