User:EugenioTL/sandbox

From Wikipedia, the free encyclopedia

In machine learning, a variational autoencoder,[1] also known as VAE, is the artificial neural network architecture introduced by Diederik P Kingma and Max Welling, belonging to the families of probabilistic graphical models and variational bayesian methods.

It is often associated with the autoencoder[2][3] model because of its architectural affinity, but there are significant differences both in the goal and in the mathematical formulation. Variational autoencoders are meant to compress the input information into a constrained multivariate latent distribution (encoding) to reconstruct it as accurately as possible (decoding). Although this type of model was initially designed for unsupervised learning[4][5], its effectiveness has been proven in other domains of machine learning such as semi-supervised learning[6][7] or supervised learning[8].

Architecture[edit]

Variational autoencoders are variational bayesian methods with a multivariate distribution as prior and a posterior, approximated by an artificial neural network, forming the so-called variational encoder-decoder structure[9][10][11].

A vanilla encoder is an artificial neural network to reduce its input information into a bottleneck representation named latent space. It represents the first half of the architecture of both encoder and variational autoencoder. For the former, the output is a fixed vector of artificial neurons. For the latter, the outgoing information is compressed into a probabilistic latent space composed still by artificial neurons. However, in variational autoencoder architecture, they represent and are treated as two distinct vectors with the same dimensions, representing the vector of means and the vector of standard deviations, respectively.

A vanilla decoder is still an artificial neural network thought to be the mirror architecture of the encoder. It takes as input the compressed information coming from the latent space, and then it expands it to produce an output that is as equal as possible to the encoder's input. While for an autoencoder, the decoder input is trivially a fixed-length vector of real values, for a variational autoencoder, it is necessary to introduce an intermediate step. Given the probabilistic nature of the latent space, it is possible to consider it as a multivariate Gaussian vector. With this assumption, and through the technique known as the reparametrization trick, it is possible to sample populations from this latent space and treat them precisely as a fixed-length vector of real values.

From a systemic point of view, both the vanilla autoencoder and the variational autoencoder models receive as input a set of high dimensional data. Then they adaptively compress it into a latent space (encoding), and finally, they try to reconstruct it as accurately as possible (decoding). Given the nature of its latent space, the variational autoencoder is characterized by a slightly different objective function: it has to minimize a reconstruction loss function like the vanilla autoencoder. However, it also takes into account the Kullback–Leibler divergence between the latent space and a vector of normal Gaussians.

Formulation[edit]

The basic scheme of a variational autoencoder. The model receives as input. The encoder compresses it into the latent space. The decoder receives as input the information sampled from the latent space and produces as similar as possible to .

From a formal perspective, given an input dataset characterized by an unknown probability function and a multivariate latent encoding vector , we want to model the data as a distribution , with defined as the set of the network parameters.

It is possible to formalize this distribution as

where is the evidence of the model's data with marginalization performed over unobserved variables and thus represents the joint distribution between input data and its latent representation according to the network parameters .

According to the Bayes' theorem, the equation can be rewritten as

In the vanilla variational autoencoder we assume with discrete dimension and that is a Gaussian distribution, then is a mixture of Gaussian distributions.

It is now possible to define the set of the relationships between the input data and its latent representation as

  • Prior
  • Likelihood
  • Posterior

Unfortunately, the computation of is very expensive and in most cases even intractable. To speed up the calculus and make it feasible, it is necessary to introduce a further function to approximate the posterior distribution as

with defined as the set of real values that parametrize .

In this way, the overall problem can be easily translated into the autoencoder domain, in which the conditional likelihood distribution is carried by the probabilistic encoder, while the approximated posterior distribution is computed by the probabilistic decoder.

ELBO loss function[edit]

The scheme of the reparameterization trick. The randomness variable is injected into the latent space as external input. In this way, it is possible to backpropagate the gradient without involving stochastic variable during the update.
The scheme of a variational autoencoder after the reparameterization trick. The model receives as input. The probabilistic encoder compresses it into the latent space composed by the mean vector and the standard deviation vector . The decoder receives as input the information sampled from the latent space and produces as similar as possible to .

As in every deep learning problem, it is necessary to define a differentiable loss function in order to update the network weights through backpropagation.

For variational autoencoders the idea is to jointly minimize the generative model parameters to reduce the reconstruction error between the input and the output of the network, and to have as close as possible to .

As reconstruction loss mean squared error and cross entropy represent good alternatives.

As distance loss between the two distributions the reverse Kullback–Leibler divergence is a good choice to squeeze under [1][12].

The distance loss just defined is expanded as

At this point, it is possible to rewrite the equation as

The goal is to maximize the log-likelihood of the LHS of the equation to improve the generated data quality and to minimize the distribution distances between the real posterior and the estimated one.

This is equivalent to minimize the negative log-likelihood, which is a common practice in optimization problems.

The loss function so obtained, also named evidence lower bound loss function, shortly ELBO, can be written as

Given the non-negative property of the Kullback–Leibler divergence, it is correct to assert that

The optimal parameters are the ones that minimize this loss function. The problem can be summarized as

The main advantage of this formulation relies on the possibility to jointly optimize with respect to parameters and .

Before applying the ELBO loss function to an optimization problem to backpropagate the gradient, it is necessary to make it differentiable by applying the so-called reparameterization trick to remove the stochastic sampling from the formation, and thus making it differentiable.

Reparameterization trick[edit]

To make the ELBO formulation suitable for training purposes, it is necessary to introduce a further minor modification to the formulation of the problem and as well as to the structure of the variational autoencoder[1][13][14].

Stochastic sampling is the non-differentiable operation with which it is possible to sample from the latent space and feed the probabilistic decoder. In order to make it feasible the application of backpropagation processes, such as the stochastic gradient descent, the reparameterization trick is introduced.

The main assumption about the latent space is that it can be considered as a set of multivariate Gaussian distributions, and thus can be described as

Given and defined as the element-wise product, the reparameterization trick modifies the above equation as

Thanks to this transformation, that can be extended also to other distributions different from the Gaussian, the variational autoencoder is trainable and the probabilistic encoder has to learn how to map a compressed representation of the input into the two latent vectors and , while the stochasticity remains out from the updating process and is injected in the latent space as an external input through the random vector .

Applications[edit]

There are many variational autoencoders applications and extensions in order to adapt the architecture to different domains and improve its performance.

-VAE is an implementation with a weighted Kullback–Leibler divergence term to automatically discover and interpret factorised latent representations. With this implementation, it is possible to force manifold disentanglement for values greater than one. The authors demonstrate this architecture ability to generate high-quality synthetic samples[15][16].

One other implementation named conditional variational autoencoder, shortly CVAE, is thought to insert label information in the latent space so to force a deterministic constrained representation of the learned data[17].

Some structures directly deal with the quality of the generated samples[18][19] or implement more than one latent space to further improve the representation learning[20][21].

Some architectures mix the structures of variational autoencoders and generative adversarial networks to obtain hybrid models with high generative capabilities[22][23][24].

See also[edit]


References[edit]

  1. ^ a b c Kingma, Diederik P.; Welling, Max (2014-05-01). Auto-Encoding Variational Bayes. arXiv:1312.6114.
  2. ^ Kramer, Mark A. (1991). "Nonlinear principal component analysis using autoassociative neural networks". AIChE Journal. 37 (2): 233–243. doi:10.1002/aic.690370209.
  3. ^ Hinton, G. E.; Salakhutdinov, R. R. (2006-07-28). Reducing the Dimensionality of Data with Neural Networks. pp. 504–507.
  4. ^ Dilokthanakul, Nat; Mediano, Pedro A. M.; Garnelo, Marta; Lee, Matthew C. H.; Salimbeni, Hugh; Arulkumaran, Kai; Shanahan, Murray (2017-01-13). Deep Unsupervised Clustering with Gaussian Mixture Variational Autoencoders. arXiv:1611.02648.
  5. ^ Hsu, Wei-Ning; Zhang, Yu; Glass, James (December 2017). Unsupervised domain adaptation for robust speech recognition via variational autoencoder-based data augmentation. pp. 16–23.
  6. ^ Ehsan Abbasnejad, M.; Dick, Anthony; van den Hengel, Anton (2017). Infinite Variational Autoencoder for Semi-Supervised Learning. pp. 5888–5897.
  7. ^ Xu, Weidi; Sun, Haoze; Deng, Chao; Tan, Ying (2017-02-12). Variational Autoencoder for Semi-Supervised Text Classification.
  8. ^ Kameoka, Hirokazu; Li, Li; Inoue, Shota; Makino, Shoji (2019-09-01). "Supervised Determined Source Separation with Multichannel Variational Autoencoder". Neural Computation. 31 (9): 1891–1914. doi:10.1162/neco_a_01217. PMID 31335290. S2CID 198168155.
  9. ^ An, J., & Cho, S. (2015). Variational autoencoder based anomaly detection using reconstruction probability. Special Lecture on IE, 2(1).
  10. ^ Khobahi, S.; Soltanalian, M. (2019). "Model-Aware Deep Architectures for One-Bit Compressive Variational Autoencoding". arXiv:1911.12410 [eess.SP].
  11. ^ Kingma, Diederik P.; Welling, Max (2019). "An Introduction to Variational Autoencoders". Foundations and Trends® in Machine Learning. 12 (4): 307–392. arXiv:1906.02691. doi:10.1561/2200000056. ISSN 1935-8237. S2CID 174802445.
  12. ^ "From Autoencoder to Beta-VAE". Lil'Log. 2018-08-12.
  13. ^ Bengio, Yoshua; Courville, Aaron; Vincent, Pascal (2013). "Representation Learning: A Review and New Perspectives". IEEE Transactions on Pattern Analysis and Machine Intelligence. 35 (8): 1798–1828. arXiv:1206.5538. doi:10.1109/TPAMI.2013.50. ISSN 1939-3539. PMID 23787338. S2CID 393948.
  14. ^ Kingma, Diederik P.; Rezende, Danilo J.; Mohamed, Shakir; Welling, Max (2014-10-31). "Semi-Supervised Learning with Deep Generative Models". arXiv:1406.5298. {{cite journal}}: Cite journal requires |journal= (help)
  15. ^ Higgins, Irina; Matthey, Loic; Pal, Arka; Burgess, Christopher; Glorot, Xavier; Botvinick, Matthew; Mohamed, Shakir; Lerchner, Alexander (2016-11-04). "beta-VAE: Learning Basic Visual Concepts with a Constrained Variational Framework". {{cite journal}}: Cite journal requires |journal= (help)
  16. ^ Burgess, Christopher P.; Higgins, Irina; Pal, Arka; Matthey, Loic; Watters, Nick; Desjardins, Guillaume; Lerchner, Alexander (2018-04-10). "Understanding disentangling in $\beta$-VAE". arXiv:1804.03599. {{cite journal}}: Cite journal requires |journal= (help)
  17. ^ Sohn, Kihyuk; Lee, Honglak; Yan, Xinchen (2015-01-01). "Learning Structured Output Representation using Deep Conditional Generative Models". {{cite journal}}: Cite journal requires |journal= (help)
  18. ^ Dai, Bin; Wipf, David (2019-10-30). "Diagnosing and Enhancing VAE Models". arXiv:1903.05789. {{cite journal}}: Cite journal requires |journal= (help)
  19. ^ Dorta, Garoe; Vicente, Sara; Agapito, Lourdes; Campbell, Neill D. F.; Simpson, Ivor (2018-07-31). "Training VAEs Under Structured Residuals". arXiv:1804.01050. {{cite journal}}: Cite journal requires |journal= (help)
  20. ^ Tomczak, Jakub; Welling, Max (2018-03-31). "VAE with a VampPrior". International Conference on Artificial Intelligence and Statistics. PMLR: 1214–1223.
  21. ^ Razavi, Ali; Oord, Aaron van den; Vinyals, Oriol (2019-06-02). "Generating Diverse High-Fidelity Images with VQ-VAE-2". arXiv:1906.00446. {{cite journal}}: Cite journal requires |journal= (help)
  22. ^ Larsen, Anders Boesen Lindbo; Sønderby, Søren Kaae; Larochelle, Hugo; Winther, Ole (2016-06-11). "Autoencoding beyond pixels using a learned similarity metric". International Conference on Machine Learning. PMLR: 1558–1566.
  23. ^ Bao, Jianmin; Chen, Dong; Wen, Fang; Li, Houqiang; Hua, Gang (2017). "CVAE-GAN: Fine-Grained Image Generation Through Asymmetric Training": 2745–2754. {{cite journal}}: Cite journal requires |journal= (help)
  24. ^ Gao, Rui; Hou, Xingsong; Qin, Jie; Chen, Jiaxin; Liu, Li; Zhu, Fan; Zhang, Zhao; Shao, Ling (2020). "Zero-VAE-GAN: Generating Unseen Features for Generalized and Transductive Zero-Shot Learning". IEEE Transactions on Image Processing. 29: 3665–3680. doi:10.1109/TIP.2020.2964429. ISSN 1941-0042. PMID 31940538. S2CID 210334032.