Skip to main content

Package for Bayesian optimal experimental design

Project description

Bayesian Optimal Experiment Design

PyPI package GitHub Release Actions Status License

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.

To run the examples in google colab, select GitHub and enter https://github.com/dkirkby/bayesdesign.

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

bayesdesign-0.5.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bayesdesign-0.5.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file bayesdesign-0.5.0.tar.gz.

File metadata

  • Download URL: bayesdesign-0.5.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for bayesdesign-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e87aadbf1721ce43d6c0e69eca5aa05924295cbd2e35c9116032a7114a14ff1a
MD5 418a2a92e592c5e30e12fba01cffc47f
BLAKE2b-256 0cb496c50def31d1f81509c9fb5bbb21614d0a22ede8ca4fac5596d73fcb27e8

See more details on using hashes here.

File details

Details for the file bayesdesign-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: bayesdesign-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for bayesdesign-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dec2ec0fa53fcba8e1acac42502a906b0f7d6a0d4db236628a30249d4006a9f2
MD5 47d89177efb93ea07a347a58844f5986
BLAKE2b-256 c38d86d426e319b8b16438968071d2648929f4f82d4a0cef3459f8538e16f7ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page