Discrete pairwise Markov networks are pretty straightforward to work with analytically. Let's use the canonical overcomplete representation, where the sufficient statistics functions are indicator functions for events \(\{X_s = j\}\) and \(\{X_s = j,X_t = k \}\), and define an exponential family of the form

where we have introduced the convenient shorthand notation

i.e. when \(x_s = j\), \(\theta_s(x_s=j)\) selects the number \(\theta_{s;j}\); similarly \(\theta_{st}(x_s=j,x_t=k)\) selects the number \(\theta_{st;jk}\), so \(\theta_s\) is a vector of size \(|\chi_s|\), and \(\theta_{st}\) is a matrix of size \(|\chi_s| \times |\chi_t|\)--in fact, they are potential tables for the factors over \(X_s\) and \((X_s, X_t)\). To see this, rewrite our exponential representation as a standard Gibbs distribution:

If we define singleton potential \(\psi_s(x_s) := \exp \{ \theta_s(x_s) \}\), and pair-wise potential \(\psi_{st}(x_s,x_t) :=\exp \{ \theta_{st}(x_s,x_t) \}\), then we see that our canonical parameters are precisely the \(\log\) potential values: \(\theta_{s;j} = \theta_s(x_s=j) = \log \psi_s(x_s=j)\), and \(\theta_{st;jk} = \theta_{st}(x_s=j,x_t=k) = \log \psi_{st}(x_s=j,x_t=k)\).

Let's consider making conditional inference in the model, which we need for Gibbs sampling. More precisely, we're interested in the marginal distribution of one node, call it \(s\), conditioned on the instantiation to all the rest of the nodes. (ypically this distribution is called the full conditional distribution). By Bayes rule,

where \(N(s)\) means \(\{n \in V, (n, s) \in E \}\), i.e. the neighbor nodes of \(s\). Not surprisingly the conditional distribution is a softmax function, as we're working with exponential family distributions.

Equivalently, we can write the above as a Gibbs distribution:

Generally, in an arbitrary Gibbs distribution \(p\), the full conditional distribution for some variable \(s\), \(p(x_s|x_{V \setminus s})\), involves precisely the factors over the Markov blanket of \(s\). The proof of this isn't too different from what we showed above for the pairwise case (i.e. expanding the factorized form of \(p\) in the numerator and denominator of \(p(x_s|x_{V \setminus s})\), then canceling out common factors).

In the specific example of an Ising model, we restrict the range of all the node values to \(\chi = \{0, 1\}\) ^{1},
and let the sufficient statistics to simply be the node values and their pairwise products, i.e., \(x_s\) for \(s \in V\), and \(x_s x_t\) for \(s, t \in E\).
The full conditional distribution then becomes

In particular, we have

which suggests this type of distribution can well be viewed as a stochastic recurrent neural network (with sigmoid activations)!

1: Traditionally the variables in an Ising model take values in \(\{-1, 1\}\).