Solution (source code)

= Solution

The prior factors involving $s_i$ are $\exp(-Js_is_j)$ for $j\in\mathcal N_i$. A likelihood factor centered at $k$ depends on $s_i$ precisely when $i\in\mathcal N_k$, equivalently $k\in\mathcal N_i$. Those factors are
$$
\exp\!\left[-\frac12\left\{x_k-\left(\sum_{j\in\mathcal N_k}s_j\right)^7\right\}^2\right],\qquad k\in\mathcal N_i.
$$
\b[Only incident prior edges and likelihoods centered at neighboring sites are affected.] In particular, the likelihood centered at $i$ does not depend on $s_i$: its mean involves only the neighbors of $i$. These are the <local likelihood factors in a hidden spin field>. The resulting conditional dependence can extend two lattice steps, beyond the nearest-neighbor prior interactions. For $K=1$, both collections are empty.