Package for Bayesian optimal experimental design
Project description
Bayesian Optimal Experiment Design
Use this package to calculate expected information gain for Bayesian optimal experiment design. For an introduction to this topic, see this interactive notebook. To perform a similar calculation with this package, use:
from bed.grid import Grid, GridStack
from bed.design import ExperimentDesigner
designs = Grid(t_obs=np.linspace(0, 5, 51))
features = Grid(y_obs=np.linspace(-1.25, 1.25, 100))
params = Grid(amplitude=1, frequency=np.linspace(0.2, 2.0, 181), offset=0)
sigma_y=0.1
with GridStack(features, designs, params):
y_mean = params.amplitude * np.sin(params.frequency * (designs.t_obs - params.offset))
y_diff = features.y_obs - y_mean
likelihood = np.exp(-0.5 * (y_diff / sigma_y) ** 2)
features.normalize(likelihood)
designer = ExperimentDesigner(params, features, designs, likelihood)
prior = np.ones(params.shape)
params.normalize(prior);
designer.calculateEIG(prior)
plt.plot(designs.t_obs, designer.EIG)
Browse the examples folder to learn more about using this package.
Installation
Install the latest released version from pypi using:
pip install bayesdesign
The only required dependency is numpy. The optional plot module also requires matplotlib.
The changes with each version are documented here.
Upgrade
To upgrade your pip-installed package to the latest released version use:
pip install bayesdesign --upgrade
Contributing
If you have feedback or would like to contribute to this package, please see our contributor's guide.
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
Built Distribution
File details
Details for the file bayesdesign-0.4.0.tar.gz
.
File metadata
- Download URL: bayesdesign-0.4.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16b58664aa165f31c6c14289d407e24f864c874f2a772acbcbaf4d31abdb8b9d |
|
MD5 | 50edb2357854b9331cac90c838d9c235 |
|
BLAKE2b-256 | e11a550240c13b91e118288347ae15c3e7de9d8f0d2f7e59bd07b9c5d7d86c4d |
File details
Details for the file bayesdesign-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: bayesdesign-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5bd57faf8b1b13d6e26fb7202dbd105556133c33e2c0f4a4521eab1c0f5f761 |
|
MD5 | 1aaa97667c8ea76397c3a058eb41321d |
|
BLAKE2b-256 | 86624e2cdf9d9c57cd51cbaf29be4f079b8bcb076295661bb40ee941099c7fee |