Skip to main content

Sliced Iterative Normalizing Flow

Project description

sinflow

License: GPL v3 Documentation Status

sinflow is a Python implementation of the sliced iterative normalizing flow (SINF) algorithm for density estimation and sampling. The package has minimal dependencies, requiring only numpy and scipy. The code is designed to be easy to use and flexible, with a focus on performance and scalability. The package is designed to be used in a similar way to scikit-learn, with a simple and consistent API.

Documentation

Read the docs at sinflow.readthedocs.io for more information, examples and tutorials.

Installation

To install sinflow using pip run:

pip install sinflow

or, to install from source:

git clone https://github.com/minaskar/sinflow.git
cd pocomc
python setup.py install

Basic example

For instance, if you wanted to draw samples from a 10-dimensional Rosenbrock distribution with a uniform prior, you would do something like:

import sinflow as sf
import numpy as np
from sklearn.datasets import make_moons

# Generate some data
x, _ = make_moons(n_samples=5000, noise=0.15)

# Fit a normalizing flow model
flow = sf.Flow()
flow.fit(x)

# Sample from the model
samples = flow.sample(1000)

# Evaluate the log-likelihood of the samples
log_prob = flow.log_prob(samples)

# Evaluate the forward transformation
z, log_det_forward = flow.forward(x)

# Invert the transformation
x_reconstructed, log_det_inverse = flow.inverse(z)

Attribution & Citation

Please cite the following paper if you found this code useful in your research:

@article{karamanis2024sinflow,
    title={},
    author={},
    journal={},
    year={2024}
}

Licence

Copyright 2024-Now Minas Karamanis and contributors.

sinflow is free software made available under the GPL-3.0 License. For details see the LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinflow-0.0.3.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

sinflow-0.0.3-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file sinflow-0.0.3.tar.gz.

File metadata

  • Download URL: sinflow-0.0.3.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sinflow-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0453aca02a798d3ba68ae1a436c5d0e6eadc0ed6dc4413498c2e694051739208
MD5 cc486707000437fcf82c13ae78f41666
BLAKE2b-256 4688c4f63544869afb08ff40f314b46255393614e7ae4f49bcd7dd6aab8bcd8b

See more details on using hashes here.

File details

Details for the file sinflow-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: sinflow-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sinflow-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e60818581f1834a29e6d0330c3ffb22493949c8c3a00b18858c0d1d7d2761bae
MD5 ab7f44c0b4491a43b54337a498ef6b47
BLAKE2b-256 1ff7574282fd202a6a9923325da8a75b7a29385530ea6aa95eb9056d0a20b9df

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page