A pairwise Markov Random Field is a way of defining a probability distribution over some vector . One way to write one is

.

Where the first sum is over all the variables, and the second sum is over neighboring pairs. Here, I generated some random distributions over binary valued variables. For each , I set , and where is some value randomly chosen from a standard Gaussian. For the pairwise terms, I used . (i.e. is .75 when the arguments are the same, and zero otherwise.) This is an “attractive network”, where neighboring variables want to have the same value.

Computing marginals is hard in graphs that are not treelike. Here, I approximate them using a nonlinear minimization of a “free energy” similar to that used in loopy belief propagation.

Here, I show the random single-variate biases and the resulting beliefs. What we see is constant valued regions (encouraged by ) interrupted where the $\phi$ is very strong.

Now, with more variables.

Now, a “repellent” network. I repeated the procedure above, but changed the pairwise interactions to . Neighboring variables want to have different values. Notice this is the opposite of the above behavior– regions of “checkerboard” interrupted where the $\phi$ outvotes .

Now, the repellent network with more variables.