ELBO公式推导 (variational inference)

Variational inference (变分推论)是为了解决当真实后验分布 p_\theta(z|x) = \frac{p_\theta(x|z)p_\theta(z)}{p_\theta(x)} 难以计算的情况下 (通常是因为p_\theta(x) = \int_z p(x|z)p(z)dz 无法直接计算),用一个方便学习的分布 q_\phi(z|x)来近似真实后验分布p_\theta(z|x).

因此 对x的log-likelihood function可以写成 \text{log } p_\theta(x) = D_{KL}(q_\phi(z|x) || p_\theta(z|x)) + \mathcal{L}(\theta,\phi ; x).  其中D_{KL}(q_\phi(z|x) || p_\theta(z|x)) 是让学到的分布q_\phi(z|x)去接近真实后验分布p_\theta(z|x), \mathcal{L}(\theta,\phi ; x)是variational lower bound,也叫evidence lower bound (ELBO).

下面来计算 \mathcal{L}(\theta,\phi ; x)

\mathcal{L}(\theta,\phi ; x) = \text{log } p_\theta(x) - D_{KL}(q_\phi(z|x) || p_\theta(z|x))

= \int q_\phi (z|x) \text{log } p_\theta(x) dz - \int q_\phi(z|x) \text{ log } \frac{q_\phi(z|x)}{p_\theta(z|x) }dz

= \int q_\phi (z|x) \text{log } p_\theta(x) - q_\phi(z|x) \text{ log } q_\phi(z|x) + q_\phi(z|x) \text{ log } p_\theta(z|x) dz

= \int - q_\phi(z|x) \text{ log } q_\phi(z|x) + q_\phi (z|x) (\text{log } p_\theta(x)+ \text{ log } p_\theta(z|x)) dz

= \int - q_\phi(z|x) \text{ log } q_\phi(z|x) + q_\phi (z|x) (\text{log } p_\theta(x,z)) dz

= \mathbb{E}_{q_\phi(z|x)}[-\text{log }q_{\phi}(z|x) + \text{log }p_\theta(x,z)]

以上为一个简单的ELBO形式

再继续往下推:

\mathcal{L}(\theta,\phi ; x) = \mathbb{E}_{q_\phi(z|x)}[-\text{log }q_{\phi}(z|x) + \text{log }(p_\theta(x|z)p_\theta(z))]

\mathcal{L}(\theta,\phi ; x) = \mathbb{E}_{q_\phi(z|x)}[\text{log } \frac{p_\theta(z)}{q_{\phi}(z|x) }+ \text{log }p_\theta(x|z)]

\mathcal{L}(\theta,\phi ; x) = \int q_\phi(z|x)\text{log } \frac{p_\theta(z)}{q_{\phi}(z|x) } dz+ \mathbb{E}_{q_\phi(z|x)}[\text{log }p_\theta(x|z)]

\mathcal{L}(\theta,\phi ; x) = -\text{KL }[p_\theta(z) || q_{\phi}(z|x)]+ \mathbb{E}_{q_\phi(z|x)}[\text{log }p_\theta(x|z)]

以上就是我们熟知的ELBO的形式,等式右边第一项是预设的prior与学到的z的分布的负KL-divergence,第二项是对x的log-likelihood。在VAE常假设p_\theta(z)\sim \mathcal{N}(0,I^d)

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值