GAN 是一個通過對抗過程來估計生成模型的框架。我們同事訓練兩個模型:a generative model G 來你和數據的概率分佈,a discriminative model D 來判斷數據來自真實數據還是生成數據。訓練是一個兩人遊戲的最大最小化過程,G最大化D判斷錯誤的概率, D最大化判斷正確的概率。在任意的函數空間內,G和D的解唯一存在,此時G完全你和訓練數據的分佈,D的的結果永遠爲1/2。當G和D被定義爲 multilayer perceptrons 時,可以通過 backpropagation 訓練。在訓練過程中完全不需要 Markov chains or unrolled approximate inference networks。
爲了通過數據x來學習分佈pg,我們定義一個先驗的輸入噪聲變量分佈pz(z),然後把先驗的隨機變量z映射到數據空間G(z;θg)。同樣的我們定義另外一個 multilayer perceptron D(x;θd),輸出x是否來自真實數據的概率。我們通過最大化分辨真實數據和生成數據來訓練D,通過最小化log(1−D(G(z)))來訓練G。
換句話說,G和D相當於玩一個 two-player minimax game with value function V(G,D): minGmaxDV(G,D)=Ex∼Pdata(x)[logD(x)]+Ez∼pz(z)[log(1−D(G(z)))]
下圖是一個訓練過程的示意圖,綠線是生成模型生成的數據,藍色虛線是判別模型判別的概率,黑色虛線是真實數據。
Theoretical Results
本文采用的 GAN 算法
Algorithm 1: Minibatch stochastic gradient descent training of generative adversarial nets. The number of steps to apply to the discriminator, k, is a hyperparameter. We used k=1, the least expensive option, in our experiments.
for number of training iterations do
for k steps do
Sample minibatch of m noise samples {z(1),…,z(m)} from noise prior pg(z).
Sample minibatch of m examples {x(1),...,x(m)} from data generating distribution pdata(x).
Update the discriminator by ascending its stochastic gradient
end for
Sample minibatch of m noise samples {z(1),…,z(m)} from noise prior pg(z).
Update the generator by descending its stochastic gradient
end for
The gradient-based updates can use any standard gradient-based learning rule. We used momentum in our experiments.