今天看了非常基础的GAN的介绍,我自己是想看更多的理论的,所以general的内容就很快过一遍了。
大致记了一些笔记如下:
一、随机变量的产生
随机变量的产生方法有很多,rejection sampling等。我们关注于:inverse transfrom method。
随机生成 0-1 之间的数 u
就是计算机智能产生(0,1)之间的均匀分布。其他分布必须基于这个分布去产生。
具体怎么"基于这个分布去产生",则用cdf的逆变换的方法去产生。
逆变换采样法
我自己的理解其实也是对0-1上的均匀分布进行逆变换,
知乎上有这样一个例子,但是感觉自己不太懂。
pdf(x) = x/ 2 有 cdf(x) = 1/4 x^2:
y = 1/4 x^2 → x = sqrt(4y) → 反函数 : y = sqrt(4x) → e = sqrt(4*drand48())
那么e就是符合 pdf = x/2 分布的变量。
二、generative models
nn的狗的照片可以转化为N维向量:N=nn。
这个N维向量形成一个复杂的“狗的概率分布”。
进一步:
用神经网络的方法,把N维简单的随机变量转化成
复杂的“狗的概率分布”。(网络的输出should follow the target distribution).
二、generative matching networks
直接产生概率分布的办法:(直接training方法)
comparing the true and the generated probability distributions and backpropagating the difference (the error) through the network
Maximum Mean Discrepancy (MMD) approach.
定义了两个概率分布的间距
之后通过后向传播来计算
三、间接training方法
The brilliant idea that rules GANs consists in replacing this direct comparison by an indirect one that takes the form of a downstream task over these two distributions
in a GAN architecture, we have a discriminator, that takes samples of true and generated data and that try to classify them as well as possible, and a generator that is trained to fool the discriminator as much as possible.
直接方法和间接方法在理论上都能得到最优的生成器(下一节有进一步证明)
四、理想情况:完美的生成器与分类器
perfect的定义: they are not constrained by any kind of (parametrised) model.

这个图还是该记在脑子里的。
indirect比direct强的地方:
For the first point, the difficulty of directly comparing two probability distributions based on samples counterbalances the apparent higher complexity of indirect method. 比较起来简单
For the second point, it is obvious that the discriminator is not known. However, it can be learned!
五、近似情况:对抗神经网络
generator的输入:随机变量
generator的输出:满足目标分布的随机变量
discriminator的输入:generator的输出
discriminator的输出:是否是true
从game theory的角度理解:min-max two-player game
平衡态(## equilibrium state):
the generator produces data from the exact targeted distribution and where the discriminator predicts “true” or “generated” with probability 1/2 for any point it receives.
六、数学细节:对抗神经网络
原Paper用的是cross-entropy error,这里用的是absolute error.

这个式子其实很好理解的
第一行:x是真实图,p_z为generator的概率分布,G(z)为生成器的输出。
D(x)要和1相减,D(G(z))要和0相减。
第二行:p_g是生成器的输出图的概率分布。

这里相当于把期望拆开来写了
