CS228 Programming Assignment#1
1
CS 228, Winter 2009
Programming Assignment #1—Inference in Graph
ical Models
In this assignment you will implement the
Sum Product Message Passing
algorithm for exact
inference in Graphical Models, and then extend the algorithm to perform
Loopy Belief Propaga
tion
for approximate inference. All code is to be written in Matlab. If you are unfamiliar with
Matlab, you should read one of the excellent Matlab tutorials available on the web (for example,
http://www.mathworks.com/academia/student
center/tutorials/launchpad.html
).
For this assignment, you may work on your own or in a pair. If you need to find a partner, you
may post on the course wiki:
http://pmai.wikidot.com/matching
. The assignment is due at
11:59pm on Thursday Feb. 5
. Submission procedures can be found on the course website at
http://www.stanford.edu/class/cs228/submissions.html
.
The primary network that we will use to test your code is the INSURANCE network (shown in
Fig.
1
below). The INSURANCE network is a realworld network that was developed for esti
mating the expected claim costs for a car insurance policyholder. There are 27 variables in the
network with between two and five values per variable. If you are curious, you can find the original
paper that mentioned this network at
http://citeseer.ist.psu.edu/binder97adaptive.html
.
You will be provided with a description of the network that can easily be read into Matlab (see
problem
1
below). We also provide a constructed clique tree and cluster graph for the network
so that your implementation will simply focus on implementing inference over these structures.
Because your code will be general enough to handle other networks, and in order to give a more
practical flavor to the power of inference, we also provide a “Things and Stuff” (TAS) network,
which is based on recent research by Geremy Heitz, a PhD student of Prof. Koller. (If you’re
interested, you can find the paper, examples, and other materials at
http://ai.stanford.edu/
∼
gaheitz/Research/TAS/
). Details on the TAS networks are below.
1.
[60 points]
Code
All code for this assignment should be copied from
/afs/ir/class/cs228/ProgrammingAssignments/PA1/assignment.
You should be able to
access this by logging into the Stanford Unix machines (e.g., cardinal.stanford.edu) using
your SUNet ID. You can also use a copy of Matlab on any of the machines that allow
CPUintensive jobs (tree, vine, bramble, hedge).
Your job is to fill in the missing portions of code – marked with YOUR CODE HERE –
in the files described below. The script
TestPA1.m
is the main routine that sets up the
tests to be run and also evaluates whether your implementation is correct. Initially, running
this script without making any code changes should result in all tests failing (though they
should run without error).
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Winter '09
 Joint probability distribution, Marginal distribution, Exact Inference, clique tree

Click to edit the document details