Surjectors
Surjectors: surjection layers for density estimation with normalizing flows - Published in JOSS (2024)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Scientific Fields
Repository
Surjection layers for density estimation with normalizing flows
Basic Info
- Host: GitHub
- Owner: dirmeier
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://surjectors.rtfd.io
- Size: 478 KB
Statistics
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 2
- Releases: 5
Topics
Metadata Files
README.md
surjectors
Surjection layers for density estimation with normalizing flows
About
Surjectors is a light-weight library for density estimation using inference and generative surjective normalizing flows, i.e., flows can that reduce or increase dimensionality. Surjectors makes use of
- Haiku`s module system for neural networks,
- Distrax for probability distributions and some base bijectors,
- Optax for gradient-based optimization,
- JAX for autodiff and XLA computation.
Examples
You can, for instance, construct a simple normalizing flow like this:
```python import distrax import haiku as hk from jax import numpy as jnp, random as jr from surjectors import Slice, LULinear, Chain from surjectors import TransformedDistribution from surjectors.nn import make_mlp
def decoderfn(ndim): def fn(z): params = makemlp([32, 32, ndim * 2])(z) means, logscales = jnp.split(params, 2, -1) return distrax.Independent(distrax.Normal(means, jnp.exp(log_scales))) return _fn
@hk.withoutapplyrng @hk.transform def flow(x): basedistribution = distrax.Independent( distrax.Normal(jnp.zeros(5), jnp.ones(5)), 1 ) transform = Chain([Slice(5, decoderfn(5)), LULinear(5)]) pushforward = TransformedDistribution(basedistribution, transform) return pushforward.logprob(x)
x = jr.normal(jr.PRNGKey(1), (1, 10)) params = flow.init(jr.PRNGKey(2), x) lp = flow.apply(params, x) ```
More self-contained examples can be found in examples.
Documentation
Documentation can be found here.
Installation
Make sure to have a working JAX installation. Depending whether you want to use CPU/GPU/TPU,
please follow these instructions.
To install the package from PyPI, call:
bash
pip install surjectors
To install the latest GitHub
bash
pip install git+https://github.com/dirmeier/surjectors@<RELEASE>
Contributing
Contributions in the form of pull requests are more than welcome. A good way to start is to check out issues labelled good first issue.
In order to contribute:
1) Clone Surjectors and install hatch via pip install hatch,
2) create a new branch locally git checkout -b feature/my-new-feature or git checkout -b issue/fixes-bug,
3) implement your contribution and ideally a test case,
4) test it by calling hatch run test on the (Unix) command line,
5) submit a PR 🙂
Citing Surjectors
If you find our work relevant to your research, please consider citing:
@article{dirmeier2024surjectors,
author = {Simon Dirmeier},
title = {Surjectors: surjection layers for density estimation with normalizing flows},
year = {2024},
journal = {Journal of Open Source Software},
publisher = {The Open Journal},
volume = {9},
number = {94},
pages = {6188},
doi = {10.21105/joss.06188}
}
Author
Simon Dirmeier sfyrbnd @ pm me
Owner
- Name: Simon Dirmeier
- Login: dirmeier
- Kind: user
- Location: Zurich, Switzerland
- Company: @SwissDataScienceCenter
- Website: simon-dirmeier.com
- Repositories: 7
- Profile: https://github.com/dirmeier
ML research @SwissDataScienceCenter
JOSS Publication
Surjectors: surjection layers for density estimation with normalizing flows
Authors
Swiss Data Science Center, Zurich, Switzerland, ETH Zurich, Zurich, Switzerland
Tags
JAX Density estimation Normalizing flow Machine learning StatisticsGitHub Events
Total
- Issues event: 1
- Watch event: 1
- Push event: 2
Last Year
- Issues event: 1
- Watch event: 1
- Push event: 2
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Simon Dirmeier | s****3@p****m | 45 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 10
- Total pull requests: 26
- Average time to close issues: 8 months
- Average time to close pull requests: 7 days
- Total issue authors: 3
- Total pull request authors: 1
- Average comments per issue: 1.1
- Average comments per pull request: 0.35
- Merged pull requests: 23
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- dirmeier (8)
- sandeshkatakam (1)
- animikhaich (1)
Pull Request Authors
- dirmeier (31)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 31 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 5
- Total maintainers: 1
pypi.org: surjectors
Surjection layers for density estimation with normalizing flows
- Documentation: https://surjectors.readthedocs.io/
- License: Apache Software License
-
Latest release: 0.3.3
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- pre-commit/action v3.0.0 composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- pypa/gh-action-pypi-publish release/v1 composite
- distrax >=0.1.2
- dm-haiku >=0.0.9
- optax >=0.1.3
- ipykernel *
- ipython *
- matplotlib *
- nbsphinx *
- pandas *
- scikit-learn *
- seaborn *
- session_info *
- sphinx *
- sphinx-autobuild *
- sphinx-book-theme >=1.1.0
- sphinx-copybutton *
- sphinx-math-dollar *
- sphinx_autodoc_typehints *
- sphinx_design *
- sphinx_fontawesome *
- sphinx_gallery *
- sphinxcontrib-fulltoc *
- tqdm *
- actions/checkout v3 composite
- actions/setup-python v3 composite
