ttbayes
Tensor-train Bayesian inference — compile a black-box Bayesian posterior into a tensor-train (TT) representation, with gravitational-wave parameter estimation as the first application.
Status: name placeholder.
0.0.1reserves the name on PyPI. None of the API below is implemented yet — do not install this expecting a working library. Development follows the checkpoint plan inplan.md.
What it will do
Given a black-box batched log-likelihood and a separable prior over continuous bounded parameters, approximate the square root of the unnormalized posterior with a tensor train:
$$\sqrt{\pi(\theta)} \approx \Psi_{\mathrm{TT}}(\theta), \qquad \widehat{\pi}{\mathrm{TT}}(\theta) = \Psi{\mathrm{TT}}(\theta)^2$$
Squaring keeps the approximate posterior nonnegative by construction. Building the TT with tempered TT-cross in physically informed (Fisher-whitened) coordinates is intended to reduce both the TT ranks and the number of expensive likelihood evaluations needed to reconstruct the posterior.
Once compiled, the TT posterior supports evaluation, log-evidence estimation, 1-D and 2-D marginals, moments, and approximate sampling — with an optional independence Metropolis–Hastings correction that restores the exact target.
Intended usage
import ttbayes as ttb
model = ttb.BlackBoxModel(
parameter_names=("chirp_mass", "mass_ratio", "luminosity_distance", "cos_inclination"),
log_likelihood=log_likelihood,
log_prior=log_prior,
)
posterior = ttb.compile(
model=model,
domain={
"chirp_mass": (28.0, 32.0, 64),
"mass_ratio": (0.4, 1.0, 64),
"luminosity_distance": (100.0, 1000.0, 64),
"cos_inclination": (-1.0, 1.0, 64),
},
transform="fisher",
positivity="square_root",
tempering=[0.1, 0.25, 0.5, 0.75, 1.0],
tolerance=1e-4,
max_rank=32,
)
print(posterior.log_evidence())
samples = posterior.sample_corrected(model=model, n=10_000, method="independence_mh")
Installation
pip install ttbayes # core: numpy, torch, tntorch
pip install "ttbayes[bilby]" # + bilby, dynesty for the GW adapter
pip install -e ".[dev]" # development
Requires Python 3.11+.
Scope
The first prototype is deliberately limited to continuous bounded parameters,
tensor-product grids, black-box batched log-likelihoods, separable priors, and a
tntorch TT-cross backend. Bilby is an optional adapter; Dynesty through Bilby
is the reference sampler.
The public API is kept independent of tntorch — tntorch.Tensor is not
exposed.
License
MIT
Metadata
Release files for ttbayes 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ttbayes-0.0.1.tar.gz | 3.3 kB | Without provenance | Details for ttbayes-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ttbayes-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for ttbayes-0.0.1-py3-none-any.whl |
Total release size: 7.1 kB
Release files / ttbayes-0.0.1.tar.gz
| Download URL | ttbayes-0.0.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f5d84786e74e76a0a8c97a21148d85d61fcc78ab774b726f94245627d0a197c
|
|
BLAKE2b-256 checksum How to use checksums |
8ceeb094cf41c0ed83c0e497b0956b1783c65e38108411d0305d295baf1c8181
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / ttbayes-0.0.1-py3-none-any.whl
| Download URL | ttbayes-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a91367c748775d636ffa01f648ada72ec27315eb875304f3750dd256c0c90f6a
|
|
BLAKE2b-256 checksum How to use checksums |
93ac138fca28f6b978a77ea7b52e665b74ec9e5aaf5da45a5308a350533ca4e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for ttbayes 0.0.1
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.