BlackBIRDS

BlackBIRDS: Black-Box Inference foR Differentiable Simulators - Published in JOSS (2023)

https://github.com/arnauqb/blackbirds

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

bayesian-inference differentiable-programming pytorch

Scientific Fields

Artificial Intelligence and Machine Learning Computer Science - 40% confidence
Last synced: 4 months ago · JSON representation ·

Repository

Black-Box Inference foR Differentiable Simulators

Basic Info
Statistics
  • Stars: 20
  • Watchers: 4
  • Forks: 1
  • Open Issues: 6
  • Releases: 4
Topics
bayesian-inference differentiable-programming pytorch
Created over 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Citation

README.md

DOI codecov Docs Build and test package PyPI version License: MIT

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

Astrophysicist now doing research on agent-based modeling at Oxford.

JOSS Publication

BlackBIRDS: Black-Box Inference foR Differentiable Simulators
Published
September 28, 2023
Volume 8, Issue 89, Page 5776
Authors
Arnau Quera-Bofarull ORCID
Department of Computer Science, University of Oxford, UK, Institute for New Economic Thinking, University of Oxford, UK
Joel Dyer ORCID
Department of Computer Science, University of Oxford, UK, Institute for New Economic Thinking, University of Oxford, UK
Anisoara Calinescu ORCID
Department of Computer Science, University of Oxford, UK
J. Doyne Farmer ORCID
Institute for New Economic Thinking, University of Oxford, UK, Mathematical Institute, University of Oxford, UK, Santa Fe Institute, USA
Michael Wooldridge ORCID
Department of Computer Science, University of Oxford, UK
Editor
Rachel Kurchin ORCID
Tags
Bayesian inference differentiable simulators variational inference Markov chain Monte Carlo

Citation (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

All Time
  • Total Commits: 220
  • Total Committers: 3
  • Avg Commits per committer: 73.333
  • Development Distribution Score (DDS): 0.2
Past Year
  • Commits: 7
  • Committers: 2
  • Avg Commits per committer: 3.5
  • Development Distribution Score (DDS): 0.429
Top Committers
Name Email 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
documentation (3) enhancement (2) invalid (1) bug (1)
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.

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 23 Last month
Rankings
Dependent packages count: 7.2%
Average: 24.3%
Dependent repos count: 41.4%
Maintainers (1)
Last synced: 4 months ago