Description

implementing two approximate inference methods for Bayesian networks, i.e., rejection sampling and Gibbs sampling in the given attached base code.(The code is attached as images,i will send the program as file later)

Input:

Bayesian network is represented as a list of nodes. Each node is represented as a list in the following order:

name: string

parent names: a list of strings. Can be an empty list

cpt: a conditional probability table represented as an array. Each entry corresponds to the conditional probability that the variable corresponding to this node is true. The rows are ordered such that the values of the node’s parent variable(s) are enumerated in the traditional way. That is, in a table, the rightmost variable alternates T, F, T, F, …; the variable to its left T, T, F, F, T, T, F, F, …; and so on.The nodes in the network will be ordered corresponding to the network topology, i.e., parent nodes will always come before their children. For example, the sprinkler network in Figure 13.15 and on our slides, is represented as:

(i attached the remaining question as image for clear output view)