Auto-encoding Variational Bayes 阅读笔记
Notation
- : intractable posterior
- : probabilistic decoder
- : recognition model, variational approximation to , also regarded as a probabilistic encoder
- : generative model
- : variational parameters
- : generative parameters
Abbreviation
- SGVB: Stochastic Gradient Variational Bayes
- AEVB: auto-encoding VB
- ML: maximum likelihood
- MAP: maximum a posteriori
Motivation
-
Problem
- How to perform efficient inference and learning in directed probabilistic models, in the presence of continuous latent variables with intractable posterior distribution and large datasets?
-
Existing Solution and Difficulty
- VB: involves the optimization of an approximation to the intractable posterior
- mean-field: requires analytical solutions of expectations w.r.t. the approximate posterior, which are also intractable in the general case
Contribution of this paper
- (1) SGVB estimator: an estimator of the variational lower bound
- yielded by a reparameterization of the variational lower bound
- simple & differentiable & unbiased
- straightforwad to optimize using standard SG ascent techniques
- (2) AEVB algorithm
- using SGVB to optimize a recognition model that allows us to perform very efficient approximate posterior inference using simple ancestral sampling, which in turn allows us to efficiently learn the model parameters, without the need of expensive iterative inference schemes (such as MCMC) per datapoint.
- condition: i.i.d. datasets & continuous latent variable per datapoint
Methodology
assumption
- directed graphical models with continuous latent variables
- i.i.d. dataset with latent variables per datapoint
- where we like to perform
- ML or MAP inference on the (global) paramters
- variational inference on the latent variable
- where we like to perform
- and : both PDFs are differentiable almost everywhere w.r.t. both and
target case
- intractability
- : so we cannot evaluate or differentiate it.
- : so the EM algorithm cannot be used.
- the required integrals for any reasonable mean-field VB algorithm: so the VB algorithm cannot be used.
- in cases of moderately complicated likelihood function, e.g. in a neural network with a nonlinear hidden layer
- a large dataset
- batch optimization is too costly => minibatch or single datapoints
- sampling bases solutions are too slow, e.g. Monte Carlo EM, since it involves a typically expensive sampling loop per datapoint.
solution and application
- efficient approximate ML or MAP estimation for (Full): Appendix F
- allow us to mimic the hidden random process and generate artificial data that resemble the real data
- efficient approximate posterior inference for a choice of
- useful for coding or data representation tasks
- efficient approximate marginal inference of : Appendix D
- allow us to perform all kinds of inference tasks where is required, such as image denoising, inpainting, and super-resolution.
1. derivation of the variational bound
Here we use to represent
Becuase , so is called the (variational) lower bound, then we have
- : act as a regularizer
- : a an expected negative reconstruction error
- TARGET: defferentiate and optimize w.r.t. both and . However, is problematic.
2. Solution-1 Naive Monte Carlo gradient estimator
- disadvantages: high variance & impractical for this purpose, 原文中出现的公式如下:
但由于我还没来得及学Monte Carlo Gradient Estimator的理论,根据VAE这边论文后面的公式,个人觉得…上面的公式应该是(数学功底不够深厚,不确定二者是否等价):
3. Solution-2 SGVB estimator
- reparamterize using a differentiable transformation of an (auxiliary) noise variable
- under certain mild conditions for a chosen approximate posterior
- under certain mild conditions for a chosen approximate posterior
- form Monte Carlo estimates as follows:
- apply the MC estimator technique to , yielding 2 SGVB estimator and :
- minibatch with size
- the number of samples L per datapoint can be set to 1 as long as the minibatch size was large enough, e.g.
3.1 Minibatch version of AEVB algorithm
- Initialize parameters
- repeate
- Random minibatch of datapoints
- Random samples from noise distribution
- Update parameters using gradients (e.g. SGD or Adagrad)
- until convergence of parameters
- return
chosen of , , and
There are three basic approaches:
- Tractable inverse CDF. Let , be the inverse CDF of .
- Examples: Exponential, Cauchy, Logistic, Rayleigh, Pareto, Weibull, Reciprocal, Gompertz, Gumbel and Erlang distributions.
- ”location-scale” family of distributions: choose the standard distribution (with location = 0, scale = 1) as the auxiliary variable , and let
- Examples: Laplace, Elliptical, Student’s t, Logistic, Uniform, Triangular and Gaussian distributions.
- 下文介绍的VAE即适用于此种情况
- Composition: It is often possible to express random variables as different transformations of auxiliary variables.
- Examples: Log-Normal (exponentiation of normally distributed variable), Gamma (a sum over exponentially distributed variables), Dirichlet (weighted sum of Gamma variates), Beta, Chi-Squared, and F distributions.
Variational Auto-Encoder
- let
- is intractable
- use a neural network for
- and are optimized jointly with the AEVB algorithm
- params of are computed from with a MLP (multi-layered perceptrons, a fully-connected neural network with a hidden layer)
- multivariae Gaussian: in case of real-valued data
- Bernouli: incase of binary data
- multivariae Gaussian: in case of real-valued data
From what mentioned above, we have:
where and are outputs of the encoding MLP.
We sample form using , where and denotes element-wize product.
Here both and are Gaussian, so we can use the estimator , since the KL divergence item is analytical. Then we have:
Solution of , Gaussian case
Let be the dimensionality of , then we have:
And:
Therefore:
此处附上相关证明:
Visulization
Since the prior of the latent space is Gaussian, linearly spaced coordinates on the unit square were transformed through the inverse CDF of the Gaussian to produce values of the latent variables .