The model is p(x|w) ∝ exp{−E(x, w)} with E(x, w) = x²/18 + Σk wk exp{−(x − ck)²/0.72} (17 bumps). Gradient ascent on the log likelihood (14.57) pushes the energy down at the data (positive phase, red) and up at samples from the model (negative phase, blue). The model starts with a deep well at x = 3.5, where there are no data. Here the partition function can be computed on a grid, so the exact log likelihood is plotted, but training uses only samples, as it must in high dimensions.
Update: w ← w + (learning rate)·(−meann ∇wE(xn) + meanm ∇wE(xm−)), with ∇wE the vector of bumps. Negative samples: exact uses quadrature (no samples); from noise runs M fresh Langevin chains (14.61) for T steps from N(0, 3²); CD starts M chains at random data points and runs k steps; persistent keeps its M chains from one update to the next. 200 data points from 0.5 N(−2, 0.55²) + 0.5 N(0.5, 0.55²).
code/ch14_sampling.py (EBM1D, ebm_train, supplementary Figures 14.S5 and 14.S6); the data are in data/ch14-ebm.json and, with the same seed, the weights here equal ebm_train.