Skip to content

Related Methods

Deep Density Destructors

Main Idea

We can view the approach of modeling from two perspectives: constructive or destructive. A constructive process tries to learn how to build an exact sequence of transformations to go from z to x. The destructive process does the complete opposite and decides to create a sequence of transforms from x to z while also remembering the exact transforms; enabling it to reverse that sequence of transforms.

We can write some equations to illustrate exactly what we mean by these two terms. Let's define two spaces: one is our data space X and the other is the base space Z. We want to learn a transformation fθ that maps us from X to Z, f:XZ. We also want a function Gθ that maps us from Z to X, f:ZX.

TODO: Plot

More concretely, let's define the following pair of equations:

zPZ$$$$x^=Gθ(z)

This is called the generative step; how well do we fit our parameters such that xx^. We can define the alternative step below:

xPX$$$$z^=fθ(x)

This is called the inference step: how well do we fit the parameters of our transformation fθ s.t. zz^. So there are immediately some things to notice about this. Depending on the method you use in the deep learning community, the functions Gθ and fθ can be defined differently. Typically we are looking at the class of algorithms where we want fθ=Gθ1. In this ideal scenario, we only need to learn one transformation instead of two. With this requirement, we can actually compute the likelihood values exactly. The likelihood of the value x given the transformation Gθ is given as:

Px^(x)=Pz(Gθ(x))|det JGθ|

Normalizing Flows

Distribution flows through a sequence of invertible transformations - Rezende & Mohamed (2015)

We want to fit a density model pθ(x) with continuous data xRN. Ideally, we want this model to:

  • Modeling: Find the underlying distribution for the training data.
  • Probability: For a new xX, we want to be able to evaluate pθ(x)
  • Sampling: We also want to be able to generate samples from pθ(x).
  • Latent Representation: Ideally we want this representation to be meaningful.

Let's assume that we can find some probability distribution for X but it's very difficult to do. So, instead of pθ(x), we want to find some parameterized function fθ(x) that we can learn.

x=fθ(x)

We'll define this as z=fθ(x). So we also want z to have certain properties.

  1. We want this z to be defined by a probabilistic function and have a valid distribution zpZ(z)
  2. We also would prefer this distribution to be simply. We typically pick a normal distribution, zN(0,1)

We begin with in initial distribution and then we apply a sequence of L invertible transformations in hopes that we obtain something that is more expressive. This originally came from the context of Variational AutoEncoders (VAE) where the posterior was approximated by a neural network. The authors wanted to

zL=fLfL1f2f1(z0)

Loss Function

We can do a simple maximum-likelihood of our distribution pθ(x).

maxθilogpθ(x(i))

However, this expression needs to be transformed in terms of the invertible functions fθ(x). This is where we exploit the rule for the change of variables. From here, we can come up with an expression for the likelihood by simply calculating the maximum likelihood of the initial distribution z0 given the transformations fL.

pθ(x)=pZ(fθ(x))|fθ(x)x|

So now, we can do the same maximization function but with our change of variables formulation:

maxθilogpθ(x(i))=maxθilogpZ(fθ(x(i)))+log|fθ(x(i))x|

And we can optimize this using stochastic gradient descent (SGD) which means we can use all of the autogradient and deep learning libraries available to make this procedure relatively painless.

Sampling

If we want to sample from our base distribution z, then we just need to use the inverse of our function.

x=fθ1(z)

where zpZ(z). Remember, our fθ() is invertible and differentiable so this should be no problem.


q(z)=q(z)|fz|1

or the same but only in terms of the original distribution X

We can make this transformation a bit easier to handle empirically by calculating the Log-Transformation of this expression. This removes the inverse and introduces a summation of each of the transformations individually which gives us many computational advantages.

logqL(zL)=logq0(z0)l=1Llog|flzl|

So now, our original expression with pθ(x) can be written in terms of z.

TODO: Diagram with plots of the Normalizing Flow distributions which show the direction for the idea.

In order to train this, we need to take expectations of the transformations.

L(θ)=Eq0(z0)[logp(x,zL)]Eq0(z0)[logq0(z0)]Eq0(z0)[l=1Llogdet|flzk|]

Choice of Transformations

The main thing that many of the communities have been looking into is how one chooses the aspects of the normalizing flow: the prior distribution and the Jacobian.

Prior Distribution

This is very consistent across the literature: most people use a fully-factorized Gaussian distribution. Very simple.

Jacobian

This is the area of the most research within the community. There are many different complicated frameworks but almost all of them can be put into different categories for how the Jacobian is constructed.

Resources

Best Tutorials


Survey of Literature


Neural Density Estimators

Deep Density Destructors

Code Tutorials

  • Building Prob Dist with TF Probability Bijector API - Blog
  • https://www.ritchievink.com/blog/2019/10/11/sculpting-distributions-with-normalizing-flows/

Tutorials

Algorithms

*

RBIG Upgrades

Cutting Edge

Github Implementations