= Solution
For $k\in\mathcal N_i$, put $a_k^{(i)}=\sum_{j\in\mathcal N_k\setminus\{i\}}s_j$ and $H_i=\sum_{j\in\mathcal N_i}s_j$. Removing all factors independent of $s_i$ from the <posterior distribution> gives, for $u\in\{-1,1\}$,
$$
w_i(u)=\exp\!\left[-JuH_i-\frac12\sum_{k\in\mathcal N_i}\{x_k-(a_k^{(i)}+u)^7\}^2\right],\qquad
\boxed{\pi_i(u\mid s_{-i},x)=\frac{w_i(u)}{w_i(+1)+w_i(-1)}.}
$$
A stable implementation uses the difference of the log weights. The conditional <log odds> are
$$
L_i=-2JH_i-\frac12\sum_{k\in\mathcal N_i}
\left[\{x_k-(a_k^{(i)}+1)^7\}^2-\{x_k-(a_k^{(i)}-1)^7\}^2\right],
$$
so $\pi_i(+1\mid s_{-i},x)=1/(1+e^{-L_i})$, a <logistic function>. For very large $|L_i|$, evaluate this logistic expression using the sign of $L_i$ to avoid exponential overflow.
For <Gibbs sampling for a finite hidden spin field>, initialize any spin configuration. At every step choose $i\in D$ uniformly, draw a fresh uniform variable, set spin $i$ to $+1$ with the probability above and to $-1$ otherwise, and leave all remaining spins fixed. This <Random-scan Gibbs sampler> has the stated <posterior distribution> invariant by <detailed balance of a random-scan Gibbs sampler>. All <conditional probabilities> are strictly between zero and one. For the one-site case, the <conditional probabilities> are both $1/2$.
Back to article page