thoglu / jammy_flows

A package to describe amortized (conditional) normalizing-flow PDFs defined jointly on tensor products of manifolds with coverage control. The connection between different manifolds is fixed via an autoregressive structure.
MIT License
42 stars 3 forks source link
manifolds normalizing-flows pdf probability-distribution

jammy_flows

This package implements (conditional) PDFs with Joint Autoregressive Manifold (MY) normalizing-flows. It grew out of work for the paper Unifying supervised learning and VAEs - coverage, systematics and goodness-of-fit in normalizing-flow based neural network models for astro-particle reconstructions [arXiv:2008.05825] and includes the paper's described methodology for coverage calculation of PDFs on tensor products of manifolds. For Euclidean manifolds, it includes an updated implementation of the offical implementation of Gaussianization flows [arXiv:2003.01941], where now the inverse is differentiable (adding Newton iterations to the bisection) and made more stable using better approximations of the inverse Gaussian CDF. Several other state-of-the art flows are implemented sometimes using slight modifications or extensions.

The package has a simple syntax that lets the user define a PDF and get going with a single line of code that should just work. To define a 10-d PDF, with 4 Euclidean dimensions, followed by a 2-sphere, followed again by 4 Euclidean dimensions, one could for example write

import jammy_flows

pdf=jammy_flows.pdf("e4+s2+e4", "gggg+n+gggg")

The first argument describes the manifold structure, the second argument the flow layers for a particular manifold. Here "g" and "n" stand for particular normalizing flow layers that are pre-implemented (see Features below). The Euclidean parts in this example use 4 "g" layers each.

drawing

Have a look at the script that generates the above animation.

Documentation

The docs can be found here.

Also check out the example notebook.

Features

General

Euclidean flows:

Spherical flows:

S1:

S2:

Interval Flows:

Simplex Flows:

For a description of all flows and abbreviations, have a look in the docs here.

Requirements

The package has been built and tested with these versions, but might work just fine with older ones.

Installation

specific version:

pip install git+https://github.com/thoglu/jammy_flows.git@*tag* 

e.g.

pip install git+https://github.com/thoglu/jammy_flows.git@1.0.0

to install release 1.0.0.

master:

pip install git+https://github.com/thoglu/jammy_flows.git

Contributions

If you want to implement your own layer or have bug / feature suggestions, just file an issue.