Examples of the ICML paper: Neural Autoregressive Flows
To reproduce the experiments done in the paper, please refer to this repo.
To use this repo, please also clone this one to the parent directory.
The snippet in
example.pycan be summarized in three steps after choosing a data distribution the learn:
- initialize the model
- fitting the distribution
- visualize the learned model
denaf = naf.DensityEstimator(flowtype=1) denaf.fit(distr, 2000) fig = naf.visualize2D(distr, denaf, res=res, rng=rng)
For the swissroll distribution one would learn the following density model (right) using Deep Sigmoidal Flow, a neural transformer. The true data distribution is visualized on the left as a comparison.
Below is the result using affine transformer (aka the IAF by Kingma et al. 2016)