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

The library is available on PyPI:

 pip install zunis 

The latest version can be installed directly from GitHub:

    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 recommended)
cd ./experiments/benchmarks
python benchmark_hypersphere.py

Library usage

For basic applications, the integrator is provided with default choices and can be created and used as follows:

import torch
from zunis.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.3

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.3
File Size Uploaded Provenance
zunis-0.3.tar.gz 41.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 100.9 kB

Release files / zunis-0.3.tar.gz

Download URL zunis-0.3.tar.gz
Size 41.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a270954ee9752250317c54aa975be1a5d6a7b94317192a11a32feac670d5c96c
BLAKE2b-256 checksum
How to use checksums
cacf3f305c7c06968285ae87a4c14dc9974b1c424db52f5eaec66fe74b046bed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.9

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

Download URL zunis-0.3-py3-none-any.whl
Size 59.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34c0fb9a0d8a198e687ecac98301116e93b7e3229bf9328066e86b7dfcf38519
BLAKE2b-256 checksum
How to use checksums
b8d97f9813b9b0a767cfc5ff0bf948ae2783e89f2f62569c99140b74bd13ed24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.9

Security for zunis 0.3

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