function GIBBS-ASK(X, e, bn, N) returns an estimate of P(X|e) local variables: N, a vector of counts for each value of X, initially zero Z, the nonevidence variables in bn x, the current state of the network, initially copied from e initialize x with random values for the variables in Z for j = 1 to N do for each Zi in Z do set the value of Zi in x by sampling from P(Zi|mb(Zi)) N[x] <- N[x] + 1 where x is the value of X in x return NORMALIZE(N)Figure 14.16 The Gibbs sampling algorithm for approximate inference in Bayesian networks; this version cycles through the variables, but choosing variables at random also works.
|
|
|
|