Skip to main content

binference

Population and hierarchical inference with PDFs.

Many objects are each measured with noise: galaxies, merger events, patients, classified documents. binference reads each object's likelihood, posterior, samples, binned measurement or classifier output. From these it infers the population the objects come from, with calibrated uncertainty, and each object's posterior under that population.

Population posteriors for a mock catalogue

The population inferred from 2000 simulated objects, under the default Dirichlet prior (top) and a Gaussian-process prior (bottom). Each panel shows the posterior median, its 68% and 95% intervals, the true density (dashed) and the stacked estimate (dotted).

Install

pip install "binference[plot]"

The installation page lists the extras and the supported Python versions.

Example

import binference

bins = binference.Bins.linear(0.0, 3.0, 15)

# a simulated stand-in for your arrays: measured values and their Gaussian errors
mock = binference.simulate.mock_1d(2000, bins, rng=42)
z_obs, z_err = mock.measurements["mean"], mock.measurements["sigma"]

lk = binference.Likelihoods.from_gaussian(z_obs, z_err, bins)
result = binference.infer(lk, rng=1)  # method="auto" chooses the engine
print(result.summary())

Documentation

To contribute, see CONTRIBUTING.md.

Status and citing

binference is alpha software, and its API may change before 1.0. If you use it, please cite it as described on the citing page.

License

MIT; see LICENSE.

Metadata

Release files for binference 0.2.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 binference 0.2.0
File Size Uploaded Provenance Actions
binference-0.2.0.tar.gz 334.3 kB With provenance Details for binference-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 561.4 kB

Release files / binference-0.2.0.tar.gz

Download URL binference-0.2.0.tar.gz
Size 334.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6667d597a25d5d827abe86e9af1d8a813ee3501c1ee049112e828453f0a1a4bf
BLAKE2b-256 checksum
How to use checksums
02edd9cea51593c1ee854bca227f219ba777503b9245b2ac0fadf1154a711356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / binference-0.2.0-py3-none-any.whl

Download URL binference-0.2.0-py3-none-any.whl
Size 227.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8854f7547b4b48df0b4ca38edc753d10d9e9f0cccd8f9fd0e027fad90e1048d
BLAKE2b-256 checksum
How to use checksums
f672c6cdf786be9adf5542bd4485a7629f8d18d18e0fe2c629421df3a936aead
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for binference 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for binference-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

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