Computer Science 121
Final Project, Part I

Getting Started

For this lab we will use the popular Bayes Net Toolbox (BNT) designed by Kevin Murphy. To get started, launch Matlab and in the File menu use Set Path ... then Add with Subfolders ... to navigate to the L:\2011_12_WINTER-CSCI_121_01\shared or L:\2011_12_WINTER-CSCI_121_02\shared folder, depending on which section you're in. Add FullBNT-1.0.4 and its subfolders to your path, and do Save then Close. (Matlab may compalain that it can't save the path permanently, but you won't need that ability to do this lab.)

Then you can follow the BNT tutorial (Creating your first Bayes net). You should read the instructions and test out the code in Matlab via copy/paste. Much of the tutorial involves digressions that aren't necessary to complete the exercise, so read carefully to make sure you aren't doing unnecessary work. You can also skip the sections on Random Parameters and Loading a network from a file, and stop after the section on Computing joint distributions. You should be able to visualize your graph by typing
>> draw_graph(bnet.dag, {'cloudy','S','R','W'})
You don't have to turn in anything from this warmup exercise. Just make sure that the marginal probability values you get match the ones in the tutorial.

Hi, this is John....

Once you've gone through the exercise above, you should be able to build a Bayes net for the burglar alarm example from the lecture notes. To test your code, I've written a little function called alarm.m. You should fill in the code with the XXXs, and test your solution by typing
>> alarm 
If everything is working right, you should see some text output, along with a nice plot of the network graph (similar to the one in the lecture, but without the tables). As you're building your solution, you may find it useful to put a return statement after the final line of working code, to avoid getting to a statement that yields an error. Note also that you should recreate the evidence from scratch for each test condition; i.e., you should always use the line evidence = cell(1,N); before adding new evidence and entering into the inference engine.

When you're done, your lab fodler will contain just the modified alarm.m file. As usual, zip up your folder and copy it to the turnin.