Skip to main content

Bayesian Ecological Modeling in Python

Project description

Biolith logo Biolith: Bayesian Ecological Modeling in Python

Test PyPI - Version DOI

Biolith is a Python package designed for Bayesian ecological modeling and analysis with a focus on occupancy modeling. It has similar goals to Unmarked and spOccupancy, but is written in Python and uses NumPyro and JAX to enable rapid model fitting and iteration.

Features

  • Hackable: Models are easy to understand and implement, no likelihood derivations needed.
  • Fast: Models can be fit on GPUs, which is fast.
  • Familiar: Everything is written in Python, making it easy to integrate into existing pipelines.

Installation

Install Biolith using pip:

pip install biolith

Accelerator support

For NVIDIA GPU support, check your CUDA version with nvidia-smi and install the corresponding JAX variant:

# CUDA 13.x
pip install biolith[cuda13]

For AMD GPUs:

pip install biolith[rocm]

For Google Cloud TPU VMs:

pip install biolith[tpu]

Usage

Here is a simple example using simulated data to get you started:

from biolith.models import occu, simulate
from biolith.utils import fit

# Simulate dataset
data, true_params = simulate()

# Fit model to simulated data
results = fit(occu, **data)

# Compare estimated occupancy probability to the true mean occupancy
print(f"Mean estimated psi: {results.samples['psi'].mean():.2f}")
print(f"Mean true occupancy: {true_params['z'].mean():.2f}")

Real-world Example

To see a real-world example on camera trap data, see this Jupyter Notebook from the EFI Statistical Methods Seminar Series or Open In Colab

Documentation

API Documentation and examples are available here.

Development

Make sure to install development dependencies, e.g. using:

pip install -e ".[dev]"

Run python -m unittest to run unit tests.

Run scripts/format.sh to format the codebase. Execute scripts/check.sh to run isort, docformatter and black in check mode along with pylint and pyright.

To install the pre-commit hook for formatting and code linting, run:

./scripts/install_precommit.sh

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or feedback, please open an issue or email haucke@mit.edu.

Acknowledgements

This work was supported by the AI and Biodiversity Change (ABC) Global Center, which is funded by the US National Science Foundation under Award No. 2330423 and Natural Sciences and Engineering Research Council of Canada under Award No. 585136. This work draws on research supported in part by the Social Sciences and Humanities Research Council.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

biolith-0.0.15.tar.gz (7.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

biolith-0.0.15-py3-none-any.whl (7.9 MB view details)

Uploaded Python 3

File details

Details for the file biolith-0.0.15.tar.gz.

File metadata

  • Download URL: biolith-0.0.15.tar.gz
  • Upload date:
  • Size: 7.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for biolith-0.0.15.tar.gz
Algorithm Hash digest
SHA256 4cb387a8bb18d8d8a2870f225aa926f3eae2b0fe75abc24ae78e16f6659b6722
MD5 591905c67366645c6db2ce620be3b0b7
BLAKE2b-256 c1dc39df1b46133a77683bca24180fe83c99d551d7db1cdb1f48b0dc6d90279c

See more details on using hashes here.

Provenance

The following attestation bundles were made for biolith-0.0.15.tar.gz:

Publisher: publish.yml on timmh/biolith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biolith-0.0.15-py3-none-any.whl.

File metadata

  • Download URL: biolith-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for biolith-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 82d17a2b13e069e4739b5a83aa4ea7c42cb0eec07e0cc5c2367ab109e24740a8
MD5 cf5aa8ea9f67d8a0a0c2b31105b8bc47
BLAKE2b-256 52e7f2701eb07d6b60e8d5871c01ab440f43afddebdc61bf03a183202c2643fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for biolith-0.0.15-py3-none-any.whl:

Publisher: publish.yml on timmh/biolith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page