Skip to main content

ZüNIS: Normalizing flows for neural importance sampling

ZüNIS (Zürich Neural Importance Sampling) a work-in-progress Pytorch-based library for Monte-Carlo integration based on Neural imporance sampling [1], developed at ETH Zürich. In simple terms, we use artificial intelligence to compute integrals faster.

The goal is to provide a flexible library to integrate black-box functions with a level of automation comparable to the VEGAS Library [2], while using state-of-the-art methods that go around the limitations of existing tools.

Installation

Using pip

As the library is not yet fully mature, we have not released it to the Python Package Index (PyPI). You can nevertheless install it with pip from this repository as follows:

 pip install 'git+https://github.com/ndeutschmann/zunis#egg=zunis&subdirectory=zunis_lib'

Setting up a development environment

If you would like to contribute to the library, run the benchmarks or try the examples, the easiest is to clone this repository directly and install the extended requirements:

# Clone the repository
git clone https://github.com/ndeutschmann/zunis.git ./zunis
# Create a virtual environment (recommended)
python3.7 -m venv  zunis_venv
source ./zunis_venv/bin/activate
pip install --upgrade pip
# Install the requirements
cd ./zunis
pip install -r requirements.txt
# Run one benchmark (GPU highly recommended)
cd ./experiments/benchmarks
python benchmark_hypersphere.py

Library usage

For basic uses, a RealNVP-based integrator is provided with default choices and can be created and used as follows:

import torch
from src.integration import Integrator

device = torch.device("cuda")


d = 2

def f(x):
    return x[:,0]**2 + x[:,1]**2

integrator = Integrator(d=d,f=f,device=device)
result, uncertainty, history = integrator.integrate()

The function f is integrated over the d-dimensional unit hypercube and

  • takes torch.Tensor batched inputs with shape (N,d) for arbitrary batch size N on device
  • returns torch.Tensor batched inputs with shape (N,) for arbitrary batch size N on device

A more systematic documentation is under construction here.

Metadata

Release files for zunis 0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zunis 0
File Size Uploaded Provenance
zunis-0.tar.gz 35.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zunis 0
File Interpreter ABI Platform
zunis-0-py3-none-any.whl Python 3 none any Details

Total release size: 92.2 kB

Release files / zunis-0.tar.gz

Download URL zunis-0.tar.gz
Size 35.8 kB
Tags Source
SHA-256 checksum
How to use checksums
caea482cf12631eaf667b5dbab85dc006a04555ab2a4162729b4fb96d239ed5e
BLAKE2b-256 checksum
How to use checksums
e1854a9d81031778f80b922f164f8b18523d9b3aebdf1b084653419cb410407a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

Release files / zunis-0-py3-none-any.whl

Download URL zunis-0-py3-none-any.whl
Size 56.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b266811c6b353a92400f5e58dc85754773dcc8b4d5d05a0d2a050552a5ea3e24
BLAKE2b-256 checksum
How to use checksums
27ede1840256f165b443f1b44732a289904897f86e02d03f2976084b2b332646
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.6.9

Security for zunis 0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page