Skip to main content

BirDePy: Birth-and-death processes in Python

BirDePy is a Python package for working with continuous time birth-and-death processes. It includes functions which can be used to approximate transition probabilities (birdepy.probability()), estimate parameter values from data (birdepy.estimate()), simulate sample paths (birdepy.simulate.discrete() and birdepy.simulate.continuous()) and generate forecasts (birdepy.forecast()). The main focus of the package is the estimation of parameter values from discretely-observed sample paths, however the much more straightforward case of estimation of parameter values from continuously observed sample paths is also included.

Please visit our website: https://birdepy.github.io/ and cite our paper:

Hautphenne S, Patch B (2024). "Birth-and-Death Processes in Python: The BirDePy Package." Journal of Statistical Software, (111)5 1-54. doi: 10.18637/jss.v111.i05.

semantic-release: angular

Numerical reliability

See GitHub Releases for release notes. The changelog retains earlier release history. Corrections to simulation, estimation, and forecasting can change results from earlier versions, including when using the same random seed.

Uniformization now chooses its Poisson-series cutoff automatically:

import birdepy as bd

probability = bd.probability(
    10, 0, 10, [2], model="pure-death", method="uniform",
    z_trunc=[0, 20], uniform_tol=1e-12,
)

uniform_tol bounds the omitted Poisson tail; it does not bound the separate error from truncating the state space with z_trunc. An explicit k is still accepted, with a warning when the omitted probability mass exceeds the tolerance. For large rate-time products, the automatic method uses shorter intervals and repeated squaring, dividing the tail budget across the intervals.

ABC returns weighted particle populations. Use sample_weights alongside samples for additional posterior summaries:

import numpy as np

result = bd.estimate(
    [0, 1], [1, 0], [1.0], [[0, 2]], model="pure-death",
    framework="abc", method="exact", eps_abc=[0, 0],
    eps_change=0, k=1000, seed=42,
)
particles = result.samples[-1]
weights = result.sample_weights[-1]
posterior_mean = np.average(particles, axis=0, weights=weights)

For ABC, p and cov use these weights, and se reports posterior standard deviations. Numeric covariance outputs have shape (n_parameters, n_parameters), including for a single parameter. A covariance that cannot be estimated is reported as a descriptive string. For other estimation frameworks, sample_weights contains the same "Not applicable" sentinel as samples.

Running the tests

From the repository root, using Python 3.10 or 3.11 in a virtual environment:

python -m pip install -r requirements.txt -r requirements.dev.txt
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 MPLBACKEND=Agg python -m pytest

Regression tests include analytic likelihood and posterior checks, simulation moments, agreement between transition-probability methods, and reproducible bootstrap estimates. The CPU suite does not validate CUDA execution.

CI checks this pinned baseline and builds a source distribution and wheel for fresh-install tests on Python 3.10–3.15 (allowing a 3.15 prerelease until final builds are available). The installed-package tests run outside the checkout so that imports use the wheel, including its bundled Laplace-inversion data. pyproject.toml declares the tested dependency minimums; newer compatible versions are selected by pip for each Python version. scikit-learn is not used by BirDePy and is no longer installed for tests.

Dependency maintenance and releases

Renovate groups compatible Python updates and filters out releases that require Python newer than 3.10 for the baseline. Major upgrades remain separate PRs. Changing the Python support floor or CI interpreter matrix is a maintainer decision, so Renovate does not automatically replace those interpreter versions.

The required test check succeeds only after both Python matrices and the release-tooling check pass. Releases on configured release branches run the same checks before publishing. Release tooling uses Node 24, npm ci, and the repository's built-in GitHub token. The PYPI_TOKEN secret is still required. Release notes are published on GitHub; releases do not push generated changelog commits to the protected branch.

To validate release tooling locally, with Node 24.10 or newer and a Python virtual environment active:

python -m pip install build setuptools wheel twine tomlkit
npm ci
npm run check:release

This check uses a temporary local Git remote, previews a breaking-change release, and builds and validates versioned Python distributions. It does not publish, use release credentials, or modify the working tree. Authentication with GitHub and PyPI is verified by the actual release job. The source version 0.0.0 is a placeholder; semantic-release sets the release version before building.

Metadata

Release files for birdepy 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for birdepy 2.0.0
File Size Uploaded Provenance Actions
birdepy-2.0.0.tar.gz 2.7 MB Without provenance Details for birdepy-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for birdepy 2.0.0
File Interpreter ABI Platform Actions
birdepy-2.0.0-py3-none-any.whl Python 3 none any Details for birdepy-2.0.0-py3-none-any.whl

Total release size: 5.3 MB

Release files / birdepy-2.0.0.tar.gz

Download URL birdepy-2.0.0.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
0714aa74b188c0f0e9faafc59d1b01bfd7e87740b528738fececbeca9d305b78
BLAKE2b-256 checksum
How to use checksums
61587e9c8bfe43401254eeef927a7be06f48182e5268297a06fe4818663cf567
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Release files / birdepy-2.0.0-py3-none-any.whl

Download URL birdepy-2.0.0-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e71ebfaaef17aa7d87239eed9d8c685d5892faefce1ca887182be268a9084f9e
BLAKE2b-256 checksum
How to use checksums
a45b61f6217b2e83775d669f76250b9e3d3d834d71828f2d40e4fc3097930231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.22

Security for birdepy 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page