Giter Site home page Giter Site logo

nflows's Introduction

nflows

nflows is a comprehensive collection of normalizing flows using PyTorch.

Installation

To install from PyPI:

pip install nflows

Usage

To define a flow:

from nflows import transforms, distributions, flows

# Define an invertible transformation.
transform = transforms.CompositeTranform([
    transforms.AffineCouplingTransform(...),
    transforms.RandomPermutation(...)
])

# Define a base distribution.
base_distribution = distributions.StandardNormal(...)

# Combine into a flow.
flow = flows.Flow(transform=transform, distribution=base_distribution)

To evaluate log probabilities of inputs:

log_prob = flow.log_prob(inputs)

To sample from the flow:

samples = flow.sample(num_samples)

Additional examples of the workflow are provided in examples folder.

Development

You can install all the dependencies using the environment.yml file to create a conda environment:

conda env create -f environment.yml

Alternatively, you can install via setup.py (the dev flag installs development and testing dependencies):

pip install -e ".[dev]"

References

nflows is derived from bayesiains/nsf originally published with

C. Durkan, A. Bekasov, I. Murray, G. Papamakarios, Neural Spline Flows, NeurIPS 2019. [arXiv] [bibtex]

nflows has been used in

Conor Durkan, Iain Murray, George Papamakarios, On Contrastive Learning for Likelihood-free Inference, ICML 2020. [arXiv].

Artur Bekasov, Iain Murray, Ordering Dimensions with Nested Dropout Normalizing Flows. [arXiv].

Tim Dockhorn, James A. Ritchie, Yaoliang Yu, Iain Murray, Density Deconvolution with Normalizing Flows. [arXiv].

nflows is used by the conditional density estimation package pyknos, and in turn the likelihood-free inference framework sbi.

nflows's People

Contributors

alvorithm avatar arashabzd avatar arturbekasov avatar conormdurkan avatar dgreenberg avatar imurray avatar jahma avatar jan-matthis avatar janfb avatar johannbrehmer avatar michaeldeistler avatar mj-will avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.