Introduction
In this assignment you will implement variable elimination on Bayes Nets.
What is supplied. You will be supplied with python code implementing Variable, Factor, and BN objects. The file bnet.py contains the class definitions for these objects. The code supports representing
factors as tables of values indexed by various settings of the variables in the factor’s scope.
The template file bnet.py also contains function prototypes for the functions you must implement.
Question 1. Implement Variable Elimination
Implement a collection of functions that operate on Factor objects and then use these functions to implement VE (variable elimination).
multiply factors Take as input a list of Factor objects; create and return a new factor that is equal
to the product of the factors in the list. Do not modify any of the input factors.
restrict factor Take as input a single factor, a variable V and a value d from the domain of that
variable; create and return a new factor that is the restriction of the input factor to the assignment
V = d. Do not modify the input factor.
sum out variable Take as input a single factor, and a variable V ; create and return a new factor that is
the result of summing V out of the input factor. Do not modify the input factor.
VE Take as input a Bayes Net object (object of class BN), a variable that is the query variable Q, and a list
of variables E that are the evidence variables (all of which have had some value set as evidence using
the variable’s set evidence interface). Compute the probability of every possible assignment
2
to Q given the evidence specified by the evidence settings of the evidence variables. Return these
probabilities as a list where every number corresponds the probability of one of Q’s possible values.
Do not modify any factor of the input bayes net.
3
384H, 3:, Assignment, Bayes, CSC, Nets
[SOLVED] Assignment 3: bayes nets csc 384h
$25
File Name: Assignment_3:_bayes_nets_csc_384h.zip
File Size: 310.86 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.