BlackBIRDS
BlackBIRDS: Black-Box Inference foR Differentiable Simulators - Published in JOSS (2023)
Science Score: 98.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 7 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
Black-Box Inference foR Differentiable Simulators
Basic Info
- Host: GitHub
- Owner: arnauqb
- License: mit
- Language: Python
- Default Branch: main
- Homepage: http://www.arnau.ai/blackbirds/
- Size: 15 MB
Statistics
- Stars: 20
- Watchers: 4
- Forks: 1
- Open Issues: 6
- Releases: 4
Topics
Metadata Files
README.md

BlackBIRDS is a Python package consisting of generically applicable, black-box inference methods for differentiable simulation models. It facilitates both (a) the differentiable implementation of simulation models by providing a common object-oriented framework for their implementation in PyTorch, and (b) the use of a variety of gradient-assisted inference procedures for these simulation models, allowing researchers to easily exploit the differentiable nature of their simulator in parameter estimation tasks. The package consists of both Bayesian and non-Bayesian inference methods, and relies on well-supported software libraries (e.g. normflows, Stimper et al. (2023)) to provide this broad functionality.
1. Installation
The easiest way to install Birds is to install it from the PyPI repository
pip install blackbirds
To get the latest development version, you can install it directly from git
pip install git+https://github.com/arnauqb/blackbirds
2. Usage
Refer to the docs for examples and specific API usage. Here is a basic example:
```python import torch
from blackbirds.models.randomwalk import RandomWalk from blackbirds.infer.vi import VI from blackbirds.posteriorestimators import TrainableGaussian from blackbirds.simulate import simulateandobserve_model
random walk model
rw = RandomWalk(n_timesteps=100)
generate synthetic data to fit to
truep = torch.logit(torch.tensor(0.25)) truedata = rw.observe(rw.run(torch.tensor([true_p])))
define loss to minimize
class L2Loss: def init(self, model): self.model = model self.lossfn = torch.nn.MSELoss() def _call_(self, params, data): observedoutputs = simulateandobservemodel(self.model, params) return self.lossfn(observed_outputs[0], data[0])
initialize generalized variational inference
posteriorestimator = TrainableGaussian([0.], 1.0) prior = torch.distributions.Normal(truep + 0.2, 1) optimizer = torch.optim.Adam(posterior_estimator.parameters(), 1e-2) loss = L2Loss(rw)
vi = VI(loss, posteriorestimator=posteriorestimator, prior=prior, optimizer=optimizer, w = 0) # no regularization
train the estimator
vi.run(truedata, 1000, maxepochswithoutimprovement=100)
```
3. Tests
To run the unit tests of the code, you need to have pytest installed,
bash
pip install pytest pytest-cov
and run the command
bash
pytest test
4. Contributing
See CONTRIBUTING.md for the contribution guidelines.
5. Citation
@article{Quera-Bofarull2023,
doi = {10.21105/joss.05776},
url = {https://doi.org/10.21105/joss.05776},
year = {2023},
publisher = {The Open Journal},
volume = {8},
number = {89},
pages = {5776},
author = {Arnau Quera-Bofarull and Joel Dyer and Anisoara Calinescu and J. Doyne Farmer and Michael Wooldridge},
title = {BlackBIRDS: Black-Box Inference foR Differentiable Simulators},
journal = {Journal of Open Source Software} }
Owner
- Name: Arnau Quera-Bofarull
- Login: arnauqb
- Kind: user
- Location: Oxford
- Website: arnau.ai
- Repositories: 42
- Profile: https://github.com/arnauqb
Astrophysicist now doing research on agent-based modeling at Oxford.
JOSS Publication
BlackBIRDS: Black-Box Inference foR Differentiable Simulators
Authors
Department of Computer Science, University of Oxford, UK, Institute for New Economic Thinking, University of Oxford, UK
Department of Computer Science, University of Oxford, UK, Institute for New Economic Thinking, University of Oxford, UK
Tags
Bayesian inference differentiable simulators variational inference Markov chain Monte CarloCitation (CITATION.cff)
cff-version: "1.2.0"
authors:
- family-names: Quera-Bofarull
given-names: Arnau
orcid: "https://orcid.org/0000-0001-5055-9863"
- family-names: Dyer
given-names: Joel
orcid: "https://orcid.org/0000-0002-8304-8450"
- family-names: Calinescu
given-names: Anisoara
orcid: "https://orcid.org/0000-0003-2082-734X"
- family-names: Farmer
given-names: J. Doyne
orcid: "https://orcid.org/0000-0001-7871-073X"
- family-names: Wooldridge
given-names: Michael
orcid: "https://orcid.org/0000-0002-9329-8410"
contact:
- family-names: Quera-Bofarull
given-names: Arnau
orcid: "https://orcid.org/0000-0001-5055-9863"
- family-names: Dyer
given-names: Joel
orcid: "https://orcid.org/0000-0002-8304-8450"
doi: 10.5281/zenodo.8377044
message: If you use this software, please cite our article in the
Journal of Open Source Software.
preferred-citation:
authors:
- family-names: Quera-Bofarull
given-names: Arnau
orcid: "https://orcid.org/0000-0001-5055-9863"
- family-names: Dyer
given-names: Joel
orcid: "https://orcid.org/0000-0002-8304-8450"
- family-names: Calinescu
given-names: Anisoara
orcid: "https://orcid.org/0000-0003-2082-734X"
- family-names: Farmer
given-names: J. Doyne
orcid: "https://orcid.org/0000-0001-7871-073X"
- family-names: Wooldridge
given-names: Michael
orcid: "https://orcid.org/0000-0002-9329-8410"
date-published: 2023-09-28
doi: 10.21105/joss.05776
issn: 2475-9066
issue: 89
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 5776
title: "BlackBIRDS: Black-Box Inference foR Differentiable Simulators"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.05776"
volume: 8
title: "BlackBIRDS: Black-Box Inference foR Differentiable Simulators"
GitHub Events
Total
- Issues event: 2
- Watch event: 6
- Issue comment event: 6
- Push event: 3
- Pull request event: 2
- Fork event: 1
- Create event: 1
Last Year
- Issues event: 2
- Watch event: 6
- Issue comment event: 6
- Push event: 3
- Pull request event: 2
- Fork event: 1
- Create event: 1
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Arnau Quera-Bofarull | a****q@p****m | 176 |
| joelnmdyer | j****r@g****m | 28 |
| arnauq | a****a@g****m | 16 |
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 29
- Total pull requests: 23
- Average time to close issues: 13 days
- Average time to close pull requests: about 13 hours
- Total issue authors: 5
- Total pull request authors: 3
- Average comments per issue: 1.0
- Average comments per pull request: 0.78
- Merged pull requests: 22
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 2
- Average time to close issues: 1 day
- Average time to close pull requests: about 2 hours
- Issue authors: 1
- Pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 3.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- joelnmdyer (14)
- arnauqb (8)
- rajeshrinet (2)
- benjaminpatrickevans (1)
Pull Request Authors
- arnauqb (12)
- joelnmdyer (11)
- ayushchopra96 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 23 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
pypi.org: blackbirds
Black-Box Inference foR Differentiable Simulators.
- Homepage: https://github.com/arnauqb/blackbirds
- Documentation: https://blackbirds.readthedocs.io/
- License: MIT License
-
Latest release: 1.0.0
published over 2 years ago