# Metropolis sampling for Bayesian networks

Gibbs sampling is a profound and popular technique for creating samples of Bayesian networks (BNs). Metropolis sampling is another popular technique, though - in my opinion - a less accessible method. Since concepts as transfer probabilities of your Markov chain and a (symmetric) proposal distribution $g$ appear, I have difficulties with understanding Metropolis sampling in the context of BNs correctly.

My approach:

Suppose we deal with the below Student BN structure and corresponding conditional probability tables (CPTs). For the topological ordering $(D, I, G, S, L)$, consider the initial state $x^{(0)} = (D = d^1, I = I^0, G = g^1, S = s^0, L = l^0)$. Based on $x^{(0)}$, if we consider $g$ to be a random walk proposal, which new states $x'$ can we consider?

If we change one variable (like Gibbs sampling) according to the fixed ordening at a time, we could obtain $x' = (D = d^0, I = I^0, G = g^1, S = s^0, L = l^0)$. Then, can we determine the acceptance ratio $\alpha$ according to the CPTs? \begin{align*} \alpha = \frac{P(x')}{P(x^{(0)})} = \frac{0.4 \cdot \ldots}{0.6 \cdot \ldots} = z \end{align*} Consecutively, with the help of a random integer $u$, we accept $x'$ as $x^{(1)}$ if $u > z$. We repeat this procedure. • I would suggest clarifying the question, or questions(?). MCMC is used in structure learning of BN's, but I am not sure that is what you are after, and how that is relevant to what states the nodes are in. – Zhubarb Dec 14 '18 at 16:24