Universal Conditional Machine

Oleg Ivanov, Michael Figurnov, Dmitry P. Vetrov

Abstract

We propose a single neural probabilistic model based on variational autoencoder that can be conditioned on an arbitrary subset of observed features and then sample the remaining features in "one shot". The features may be both real-valued and categorical. Training of the model is performed by stochastic variational Bayes. The experimental evaluation on synthetic data, as well as feature imputation and image inpainting problems, shows the effectiveness of the proposed approach and diversity of the generated samples.

Introduction

In generative modeling, researchers typically focus on learning either a joint distribution $p(x)$ (standard VAEs) or a specific conditional distribution $p(x|y)$ where $y$ is a fixed set of attributes (Conditional VAEs). However, real-world data is often "patchy." For example, in a medical database, different patients might have different missing test results. In image editing, one might want to remove an object from the center or extend the edges of a landscape. Theoretically, handling every possible combination of observed and missing features would require an exponential number of models ($2^D$ for $D$ features).

To address this, we propose the Variational Autoencoder with Arbitrary Conditioning (VAEAC). VAEAC is a single probabilistic framework that can be conditioned on any arbitrary subset of features to sample the remaining ones in "one shot," effectively learning all possible conditional distributions simultaneously.

Methodology

VAEAC builds on the standard VAE architecture but introduces a crucial modification: the latent variable's prior is no longer a fixed standard Gaussian. Instead, it is conditioned on the observed data.

Key Components

  • The Mask ($b$): A binary vector that identifies which features are observed and which are missing.
  • Prior Network: Unlike a standard VAE, VAEAC uses a neural network to compute the parameters of the latent prior $p(z | x_{observed}, b)$. This allows the "context" of the observed features to shape the latent space.
  • Generative Network: This network takes a sample from the latent space $z$ and the observed features to reconstruct the missing features $x_{missing}$.
  • Proposal Network: Used during training, this network approximates the posterior $q(z | x_{all}, b)$ to guide the learning process.

The model is trained by maximizing a modified Variational Lower Bound (ELBO). To ensure numerical stability and prevent latent distributions from diverging, we introduce a Normal-Gamma prior on the prior network's parameters.

Experimental Evaluation

We evaluated VAEAC across three distinct domains:

  1. Feature Imputation: Tested on five UCI repository datasets (WhiteWine, Yeast, Mushroom, Zoo, and Phishing) containing both real-valued and categorical data.
  2. Image Inpainting: Evaluated using MNIST (handwritten digits), Omniglot (characters), and CelebA (celebrity faces).
  3. Synthetic Data: Used a 2D multimodal distribution to demonstrate the model's ability to capture multiple local optima.

Key Results

VAEAC demonstrates superior performance in both speed and accuracy. In feature imputation tasks, it consistently outperformed or matched classical methods like MICE and MissForest, as well as the GAN-based GAIN model, in terms of Normalized Root Mean Square Error (NRMSE).

NRMSE for feature imputation on UCI datasets.

In image inpainting, VAEAC achieved higher Peak Signal-to-Noise Ratio (PSNR) scores than specialized models like Context Encoders. A significant advantage of VAEAC is its ability to handle multimodality. While deterministic models often produce blurry averages, VAEAC's probabilistic nature allows it to sample diverse and sharp possibilities. When evaluating the best of 10 samples, VAEAC significantly outperformed single-result models, highlighting the value of its diversity.

PSNR for image inpainting on CelebA dataset across different mask types.

Furthermore, VAEAC is highly efficient. Compared to the "Universal Marginalizer," VAEAC was approximately 1,400 times faster at generating 100 samples (0.7ms vs 1s) while maintaining better log-likelihood on MNIST.

Discussion and Conclusion

VAEAC provides a robust, "one-shot" solution for arbitrary conditional sampling, making it significantly faster than iterative methods for real-time applications. While VAEs can sometimes produce slightly blurry images compared to GANs, future work could involve adding an adversarial loss to improve visual sharpness. Additionally, while VAEAC handles arbitrary masks, its performance is optimized when the distribution of masks during training reflects those encountered at test time. Overall, VAEAC represents a significant step toward a universal conditional machine capable of filling any "hole" in data regardless of its shape or location.

Summary updated

BibTeX
@inproceedings{ivanov2019universal,
  author = {Oleg Ivanov and Michael Figurnov and Dmitry P. Vetrov},
  title = {{Universal Conditional Machine}},
  booktitle = {International Conference on Learning Representations},
  year = {2019},
  url = {https://openreview.net/forum?id=rJNCgZEF35},
}
Figure