Conjugate Bayesian Models
Last update: June 2019.
Lightweight Python library implementing a few conjugate Bayesian models. For details on the derivations see [1].
pip3 install conjugate-bayes
We support the following:
To fit distribution models
- Beta-Bernoulli
- Gamma-Poisson
- Normal-Inverse-Gamma
To fit regression models
- Linear regression with Normal Inverse-Gamma prior
- Linear regression with Zellner's g-prior
Future work
- Dirichlet-Multinomial
- Normal-Inverse-Wishart
Usage
Below we show an example fitting a simple Bayesian linear regression with unknown beta and unknown variance.
model = NIGLinearRegression(mu=np.zeros(2), v=100*np.eye(2), a=0.5, b=0.5)
model.fit(x_tr, y_tr)
sigma2 = model.get_marginal_sigma2()
beta = model.get_conditional_beta(sigma2=sigma2.mean())
The above example results in the following prediction intervals.
For further details the examples/ folder.
References
[1] P. D. Hoff, A First Course in Bayesian Statistical Methods (New York: Springer-Verlag, 2009).
License
This library is available under the MIT License.
Metadata
Release files for conjugate-bayes 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 | |
|---|---|---|---|---|
| conjugate-bayes-0.0.1.tar.gz | 1.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| conjugate_bayes-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.4 kB
Release files / conjugate-bayes-0.0.1.tar.gz
| Download URL | conjugate-bayes-0.0.1.tar.gz |
|---|---|
| Size | 1.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acae1b38cde07686ee92f4e4af09b2fd522a2b30773864064fdc0d77ae9280dd
|
|
BLAKE2b-256 checksum How to use checksums |
99f5a714fb31dd41f91e1cdaac0823a4c9b4b452c52fd1bcd9b12cbaecf10498
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
|
Release files / conjugate_bayes-0.0.1-py3-none-any.whl
| Download URL | conjugate_bayes-0.0.1-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e642925550eef870683db7167426f9991bb6e7d8ce6d84978dee6ea8f23a9304
|
|
BLAKE2b-256 checksum How to use checksums |
e841a46a3278ddcbb2f8114820b21901b6bc4d1673a19b698f23983ba1f17d31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3
|
Security for conjugate-bayes 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.