bayesmith
A Bayesian model is a graph of operators. Deterministic operators propagate dependence; probabilistic operators contribute a conditional density. Together they are the joint distribution.
bayesmith makes that graph explicit and inspectable, and then uses its structure to choose how the model is fitted — an exact solve where the structure permits one, NUTS where it does not.
block 0 {x} Wiener exact (linear_in checked, 3 scales)
block 1 {z} enumerate 4 states
block 2 {sigma, nu} NUTS (numpyro) no exact structure found
The model tells you how it will be fitted, before it is fitted.
What bayesmith is not
It is not another probabilistic programming language. Distributions, MCMC kernels, variational inference and transforms all come from NumPyro. bayesmith is the dispatch layer above them, and every line in it must answer "why can NumPyro not do this?"
What it owns, because a trace-based PPL structurally cannot:
- Structural exact inference — conjugate / Wiener / GCR / GLS solves, and exact enumeration of discrete latents, selected per subgraph.
- Streaming evidence — square-root information factors combined exactly across datasets and observing epochs.
- Diagnostics on the graph — identifiability, prior sensitivity, and linearity checking of the declarations the dispatcher relies on.
Declarations such as linear_in are claims about the model, not hints, so
they are checked rather than trusted: a node declared linear is probed at
three scales before any exact solve is allowed to use it.
Worked examples
docs/factor-partition-examples.md walks
two models from declaration to auto-partitioned sampling -- three factors
three routes, then a hierarchy where the ancestry rule earns its keep. Every
printout there was produced by running the code shown, and the partitions are
pinned by tests/dispatch/test_factor.py.
Status
0.3.0. Published so other packages can depend on it by name -- and one
now does, in two places. rheplicant's auto-partition and log-space seams
import dispatch.factor.first_fit and exact.loglinear from here; and its
adapter, which presents a pipeline as a Graph, reads AffinityRefused's
payload and declares complex latents with ComplexNormal. That second pair
is what the 0.3 floor names. Alpha in the classifier's sense: the API may
still move -- 0.3.0 makes reason required on NotGaussian and
NotLogLinear, which is breaking for anyone constructing them directly.
Implemented and tested, 1235 tests: the graph core with plates and joint
log-density; the NumPyro bridge, so any graph is runnable through NUTS;
structural dispatch with the linear-Gaussian exact solves; the FACTOR
partition -- as many exact blocks as the model has factors, grouped by
pairwise probe, with log-space blocks discovered rather than declared
(factor_partition, sample_factors, log_space); exact enumeration of
discrete latents; streaming evidence as square-root information factors; and
graph diagnostics for identifiability, prior sensitivity and linearity.
Two things the page above describes that 0.1.0 does not do yet. Stated here because a front page is a claim, and finding out afterwards is worse than reading it now:
- Enumeration is not dispatcher-selected.
bayesmith.exact.discretecomputes the exact marginal and the posterior marginals over declared discrete latents, and reads theDiscrete(n)support declaration to do it — butclassifydoes not yet route a discrete subgraph to it. Theblock 1 {z} enumerate 4 statesline above is therefore a design sketch rather than a transcript; call the module directly. - Forward-backward is not implemented, so a chain of
Tdiscrete latents costsn ** Tby enumeration rather thanT * n**2. Enumeration refuses past a budget rather than hanging, and names the count it would have visited.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bayesmith-0.3.0.tar.gz.
File metadata
- Download URL: bayesmith-0.3.0.tar.gz
- Upload date:
- Size: 587.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74824ebb517d392fad1bd758947a4c82c45793af107d4bd49f778f2e1c672130
|
|
| MD5 |
d1fe888cfe400eef878b385380417b6e
|
|
| BLAKE2b-256 |
b288bc15b3765a9a289d80ba8fd15ee8d36df55866394f867d88dfe1e7544f95
|
Provenance
The following attestation bundles were made for bayesmith-0.3.0.tar.gz:
Publisher:
publish.yml on zzhang0123/bayesmith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bayesmith-0.3.0.tar.gz -
Subject digest:
74824ebb517d392fad1bd758947a4c82c45793af107d4bd49f778f2e1c672130 - Sigstore transparency entry: 2611864697
- Sigstore integration time:
-
Permalink:
zzhang0123/bayesmith@eb69414d7b1dfe9a3f388e5cc31743a161a1a16c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/zzhang0123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@eb69414d7b1dfe9a3f388e5cc31743a161a1a16c -
Trigger Event:
push
-
Statement type:
File details
Details for the file bayesmith-0.3.0-py3-none-any.whl.
File metadata
- Download URL: bayesmith-0.3.0-py3-none-any.whl
- Upload date:
- Size: 246.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1635da0a6376e897258107e8628000118150c5ae99f4c29435328a13df9786ea
|
|
| MD5 |
6312e357e6a92157534fa60260e07d6d
|
|
| BLAKE2b-256 |
e9443ae8b67cb5930ae65eb20e1271f6e7814038b12485e289b2ada53c9854e4
|
Provenance
The following attestation bundles were made for bayesmith-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on zzhang0123/bayesmith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bayesmith-0.3.0-py3-none-any.whl -
Subject digest:
1635da0a6376e897258107e8628000118150c5ae99f4c29435328a13df9786ea - Sigstore transparency entry: 2611864703
- Sigstore integration time:
-
Permalink:
zzhang0123/bayesmith@eb69414d7b1dfe9a3f388e5cc31743a161a1a16c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/zzhang0123
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@eb69414d7b1dfe9a3f388e5cc31743a161a1a16c -
Trigger Event:
push
-
Statement type: