← capítulo

Mean-field Boltzmann machines

Denoise a binary image with one belief: a pixel probably looks like its neighbors.

Write that as an energy, read the energy as a probability, and solve it with the cheapest approximate inference there is — mean field. No training set, no labels.

The tug of war

The model

Ising / Boltzmann energy, then a Boltzmann distribution over configurations:

E(x)=J(i,j)xixj    hixiyiE(x) = -J \sum_{(i,j)} x_i x_j \; - \; h \sum_i x_i y_i p(x)=1Zexp ⁣(E(x))p(x) = \frac{1}{Z} \exp\!\big(-E(x)\big)

ZZ sums over 25762^{576} configurations of a 24×24 grid — intractable. So we don't compute it.

Mean field

Approximate the posterior with independent per-pixel coins, one mean μi\mu_i each, and update each by the field pressing on it:

μitanh ⁣(JjN(i)μj  +  hyi)\mu_i \leftarrow \tanh\!\Big( J \sum_{j \in \mathcal{N}(i)} \mu_j \; + \; h\, y_i \Big)

Sweep it one pixel at a time to convergence. That minimizes the free energy:

F(μ)=Eq[E(x)]H(q)=logZ+KL(qp)F(\mu) = \mathbb{E}_q[E(x)] - H(q) = -\log Z + \mathrm{KL}(q \,\|\, p)

Driving FF down pushes the approximation toward the true posterior.

Watch it denoise

Top: the current mean-field estimate μ\mu, sweep by sweep. Bottom: the free energy, sliding downhill and never rising.

The guarantee

Sequential (Gauss-Seidel) sweeps are coordinate descent on FF — so it only ever goes down. Cousin to EM's monotone climb, pointing the other way.

−1009.6 → −1351.7, converged in 13 sweeps.

Scratch vs. baseline

18% salt-and-pepper noise on a 24×24 "3". No sklearn twin — the honest baseline is a 3×3 median filter (majority vote). BernoulliRBM is a cousin, not a substitute (it learns its couplings).

Iteration over the whole grid beats a one-shot local vote by ~4 dB.

Takeaways