Skip to main content
. 2022 Mar 16;24(3):415. doi: 10.3390/e24030415
Algorithm 1 Traing NVP-MC
Input: Energy function U(x), batch size M, learning rate α, number of iterations N, empty buffer B, transition kernels Kθ and Kθ1.
1: Initialize B using HMC without the MH step. Initialize the parameters of the transition kernel Kθ and parameters of the discriminator Dϕ.
2: for i=1i=N do
3:       Sample a batch {(x,v)(i)}iN of Gaussian noise as the start points.
4:       for i=1i=M do
5:             Randomly sample a number u in open interval (0,1).
6:             Choose transition kernel: Kθ(x,v)=Kθ(x,v),0<u<0.5Kθ1(x,v),1>u>0.5.
7:             Generate the new sample {(x,v)(i)} through Kθ.
8:             Accept the new sample with probability computed by Equation (4),
9:             and replace the samples in B with the accepted samples.
          end for
10:           Sample a batch {(x)(i)}iN from B as the correct samples.
11:           Update the discriminator:
12:           ϕϕαϕ1Mi=1MlogDϕx(i)+log1DϕKθx(i).
13:           Update the transition kernel:
14:           θθαθ1Mi=1Mlog1DϕKθx(i).
          end for