Project 3

Fall 2022

Due: F 11/4 @ 5:00 PM

9 points

For this project, you will implement routines for exact inference for Bayesian networks. Begin by implementing routines for efficiently manipulating factors based on Koller and Friedman's product-factor algorithm. You will then use these routines to implement Russell and Norvig's variable elimination algorithm.

You must implement the following classes and methods:

`public Variable( String label, int cardinality )`, which constructs a variable with the specified label and cardinality.`public Variable( String label, int cardinality, ArrayList<Variable> parents )`, which creates a variable with the specified label, cardinality, and parents.`public void Variable.instantiate( int value )`, which instantiates the variable to the specified value.`public void Variable.set( int[] assignments, double probability )`, which sets the position in the dope vector specified by the assignments to the probability.`public Network()`, which constructs a Bayesian network.`public void Network.add( Variable variable )`, which adds the specified variable to the Bayesian network.`public Factor Network.elimination( Variable query, ArrayList<Variable> evidence )`, which uses the variable-elimination algorithm to compute the probability distribution of the query given the evidence.`public double Factor.getProbability( int[] assignments )`, which returns the probability specified by the assignments.`public String Factor.toString()`, which returns a string representation of the factor.

On Canvas, in p3.zip, you can find a class implementation for the drug-study problem we discussed in lecture. You can also find this file on cs-class.

Evaluate your implementation three problems:

- Russell and Norvig's burglary network,
- Russell and Norvig's sprinkler network (Figure 14.12a),
- one problem of your choosing from a reputable source with three or more nodes

In accordance with the class policies and Georgetown's Honor Code, I certify that, with the exceptions of the course materials and those items noted below, I have neither given nor received any assistance on this project. Name NetID

When you are ready to submit your program for grading, create a
zip file named `submit.zip` containing your source files,
honor statement, and transcript by typing

$ zip submit.zip *.java transcript HONORDo not include these files in a subdirectory. Upload

*
Copyright © 2022 Mark Maloof. All Rights Reserved.
This material may not be published, broadcast, rewritten,
or redistributed.
*