# sinflow
[](https://github.com/minaskar/sinflow/blob/master/LICENSE)
[](https://sinflow.readthedocs.io/en/latest/?badge=latest)
``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](https://sinflow.readthedocs.io) for more information, examples and tutorials.
## Installation
To install ``sinflow`` using ``pip`` run:
```bash
pip install sinflow
```
or, to install from source:
```bash
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:
```python
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:
```bash
@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.
Raw data
{
"_id": null,
"home_page": null,
"name": "sinflow",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Minas Karamanis <minaskar@gmail.com>",
"keywords": "sinf, normalizing-flow",
"author": null,
"author_email": "Minas Karamanis <minaskar@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/fd/7f/6283e9479305765a6703ec120be37e795443ef914cf7e15cb200cc4ace66/sinflow-0.1.5.tar.gz",
"platform": null,
"description": "# sinflow\n\n[](https://github.com/minaskar/sinflow/blob/master/LICENSE)\n[](https://sinflow.readthedocs.io/en/latest/?badge=latest)\n\n\n``sinflow`` is a Python implementation of the sliced iterative normalizing flow (SINF) algorithm\nfor density estimation and sampling. The package has minimal dependencies, requiring only\n``numpy`` and ``scipy``. The code is designed to be easy to use and flexible, with a focus on\nperformance and scalability. The package is designed to be used in a similar way to ``scikit-learn``,\nwith a simple and consistent API.\n\n## Documentation\n\nRead the docs at [sinflow.readthedocs.io](https://sinflow.readthedocs.io) for more information, examples and tutorials.\n\n## Installation\n\nTo install ``sinflow`` using ``pip`` run:\n\n```bash\npip install sinflow\n```\n\nor, to install from source:\n\n```bash\ngit clone https://github.com/minaskar/sinflow.git\ncd pocomc\npython setup.py install\n```\n\n## Basic example\n\nFor instance, if you wanted to draw samples from a 10-dimensional Rosenbrock distribution with a uniform prior, you would do something like:\n\n```python\nimport sinflow as sf\nimport numpy as np\nfrom sklearn.datasets import make_moons\n\n# Generate some data\nx, _ = make_moons(n_samples=5000, noise=0.15)\n\n# Fit a normalizing flow model\nflow = sf.Flow()\nflow.fit(x)\n\n# Sample from the model\nsamples = flow.sample(1000)\n\n# Evaluate the log-likelihood of the samples\nlog_prob = flow.log_prob(samples)\n\n# Evaluate the forward transformation\nz, log_det_forward = flow.forward(x)\n\n# Invert the transformation\nx_reconstructed, log_det_inverse = flow.inverse(z)\n```\n\n\n## Attribution & Citation\n\nPlease cite the following paper if you found this code useful in your research:\n\n```bash\n@article{karamanis2024sinflow,\n title={},\n author={},\n journal={},\n year={2024}\n}\n```\n\n## Licence\n\nCopyright 2024-Now Minas Karamanis and contributors.\n\n``sinflow`` is free software made available under the GPL-3.0 License. For details see the `LICENSE` file.\n",
"bugtrack_url": null,
"license": null,
"summary": "Sliced Iterative Normalizing Flow",
"version": "0.1.5",
"project_urls": {
"Bug Reports": "https://github.com/minaskar/sinflow/issues",
"Homepage": "https://github.com/minaskar/sinflow",
"Source": "https://github.com/minaskar/sinflow"
},
"split_keywords": [
"sinf",
" normalizing-flow"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d6926d6d458b6c3ed5773ef0eb2ce1d1e504cd3edc08a08bf74eb5632e88faf9",
"md5": "035450b8e934287c435cf8e79cec01f7",
"sha256": "d0cfae17f3a1e7e87a9a0941ecf8b1f66dfc55c9881e1ff29ddc0a7129b9a308"
},
"downloads": -1,
"filename": "sinflow-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "035450b8e934287c435cf8e79cec01f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 27702,
"upload_time": "2024-11-27T00:49:53",
"upload_time_iso_8601": "2024-11-27T00:49:53.774933Z",
"url": "https://files.pythonhosted.org/packages/d6/92/6d6d458b6c3ed5773ef0eb2ce1d1e504cd3edc08a08bf74eb5632e88faf9/sinflow-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fd7f6283e9479305765a6703ec120be37e795443ef914cf7e15cb200cc4ace66",
"md5": "2cc5b4d74d218c050ab3d79959039790",
"sha256": "837a806923f8858783b1d38953e8d3440d104668677a7711afbb69a591a74ed0"
},
"downloads": -1,
"filename": "sinflow-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "2cc5b4d74d218c050ab3d79959039790",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 29393,
"upload_time": "2024-11-27T00:49:54",
"upload_time_iso_8601": "2024-11-27T00:49:54.713286Z",
"url": "https://files.pythonhosted.org/packages/fd/7f/6283e9479305765a6703ec120be37e795443ef914cf7e15cb200cc4ace66/sinflow-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 00:49:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "minaskar",
"github_project": "sinflow",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
">=",
"1.20.0"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.4.0"
]
]
}
],
"lcname": "sinflow"
}