Project 3

Fall 2019

Due: M 12/9 @ 11:59 PM

10 points

For this project, you will implement routines for exact and approximate 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.

Evaluate your implementation three problems:

- Russell and Norvig's burglary network,
- two problems of your choosing from reputable sources with three or more nodes

- Implement Russell and Norvig's variable enumeration algorithm for exact inference (+3%)
- Implement Russell and Norvig's Gibbs sampling algorithm for approximate inference (+7%)

Name NetID 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.

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 © 2019 Mark Maloof. All Rights Reserved.
This material may not be published, broadcast, rewritten,
or redistributed.
*