You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementation of Non-Linear Independent Component Estimation (NICE & RealNVP) in TF-2
This repository presents an implementation in TensorFlow v2 of NICE and RealNVP models, as described in the 2014 paper authored by Laurent Dinh,
David Krueger, and Yoshua Bengio and in the 2016 paper authored by Laurent Dinh, Jascha Sohl-Dickstein, Samy Bengio. The NICE model serves as the foundational layer for subsequent normalizing flow models.
Model Explenantion
Main Components
The main idea behind the model is to:
Transform the inital unknown data distribution into a latent space with a known density via an invertible function.
Train the model by maximizing the known likelihood of the mapped data distribution by the change-of-variable rule.
Sample from the known density and invert the sampled points to reconstruct the original data space.
The following is the mathematical implementation of the previously discussed process:
Define the "latent" hidden space known distribution as the product of independent Logistic or Gaussian univariate densities:
Since $f$ must be invertible in order to evaluate the likelihood, update the parameters, and invert the samples from the base prior distribution, the authors choose to implement
and additive coupling rule which takes the following form:
Partition the initial data space into two partitions $x_{a}\in\mathbb{R}^{D-b}$ and $x_{b}\in\mathbb{R}^{D-a}$
To make the function more flexible the authors propose to multiply the output of the final coupling transformation with an invertible function which is applied element wise:
In the paper RealNVP the authors combined the addition and scaling couplings to jointly learn to translate and scale the base density space with input dependent translation and scaling parameters.
The coupling takes the following form: