bayesdesign


Namebayesdesign JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/dkirkby/bayesdesign
SummaryPackage for Bayesian optimal experimental design
upload_time2024-09-24 22:40:12
maintainerNone
docs_urlNone
authorDavid Kirkby
requires_python>=3.6
licenseNone
keywords bayes optimization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bayesian Optimal Experiment Design

[![PyPI package](https://img.shields.io/badge/pip%20install-bayesdesign-brightgreen)](https://pypi.org/project/bayesdesign/) [![GitHub Release](https://img.shields.io/github/v/release/dkirkby/bayesdesign?color=green)](https://github.com/dkirkby/bayesdesign/releases) [![Actions Status](https://github.com/dkirkby/bayesdesign/workflows/Test/badge.svg)](https://github.com/dkirkby/bayesdesign/actions) [![License](https://img.shields.io/github/license/dkirkby/bayesdesign)](https://github.com/dkirkby/bayesdesign/blob/main/LICENSE)

Use this package to calculate expected information gain for Bayesian optimal experiment design. For an introduction to this topic, see this [interactive notebook](https://observablehq.com/@dkirkby/boed). To perform a similar calculation with this package, use:
```python
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](https://github.com/dkirkby/bayesdesign/) to learn more about using this package.

## Installation

Install the [latest released version](https://github.com/dkirkby/bayesdesign/releases/latest) from [pypi](https://pypi.org/project/bayesdesign/) 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](CHANGELOG.md).

## Upgrade

To upgrade your pip-installed package to the [latest released version](https://github.com/dkirkby/bayesdesign/releases/latest) use:
```
pip install bayesdesign --upgrade
```

## Contributing

If you have feedback or would like to contribute to this package, please see our [contributor's guide](CONTRIBUTING.md).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dkirkby/bayesdesign",
    "name": "bayesdesign",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "bayes, optimization",
    "author": "David Kirkby",
    "author_email": "dkirkby@uci.edu",
    "download_url": "https://files.pythonhosted.org/packages/e1/1a/550240c13b91e118288347ae15c3e7de9d8f0d2f7e59bd07b9c5d7d86c4d/bayesdesign-0.4.0.tar.gz",
    "platform": null,
    "description": "# Bayesian Optimal Experiment Design\n\n[![PyPI package](https://img.shields.io/badge/pip%20install-bayesdesign-brightgreen)](https://pypi.org/project/bayesdesign/) [![GitHub Release](https://img.shields.io/github/v/release/dkirkby/bayesdesign?color=green)](https://github.com/dkirkby/bayesdesign/releases) [![Actions Status](https://github.com/dkirkby/bayesdesign/workflows/Test/badge.svg)](https://github.com/dkirkby/bayesdesign/actions) [![License](https://img.shields.io/github/license/dkirkby/bayesdesign)](https://github.com/dkirkby/bayesdesign/blob/main/LICENSE)\n\nUse this package to calculate expected information gain for Bayesian optimal experiment design. For an introduction to this topic, see this [interactive notebook](https://observablehq.com/@dkirkby/boed). To perform a similar calculation with this package, use:\n```python\nfrom bed.grid import Grid, GridStack\nfrom bed.design import ExperimentDesigner\n\ndesigns = Grid(t_obs=np.linspace(0, 5, 51))\nfeatures = Grid(y_obs=np.linspace(-1.25, 1.25, 100))\nparams = Grid(amplitude=1, frequency=np.linspace(0.2, 2.0, 181), offset=0)\n\nsigma_y=0.1\nwith GridStack(features, designs, params):\n    y_mean = params.amplitude * np.sin(params.frequency * (designs.t_obs - params.offset))\n    y_diff = features.y_obs - y_mean\n    likelihood = np.exp(-0.5 * (y_diff / sigma_y) ** 2)\n    features.normalize(likelihood)\n\ndesigner = ExperimentDesigner(params, features, designs, likelihood)\n\nprior = np.ones(params.shape)\nparams.normalize(prior);\n\ndesigner.calculateEIG(prior)\n\nplt.plot(designs.t_obs, designer.EIG)\n```\n\nBrowse the [examples folder](https://github.com/dkirkby/bayesdesign/) to learn more about using this package.\n\n## Installation\n\nInstall the [latest released version](https://github.com/dkirkby/bayesdesign/releases/latest) from [pypi](https://pypi.org/project/bayesdesign/) using:\n```\npip install bayesdesign\n```\nThe only required dependency is numpy. The optional plot module also requires matplotlib.\n\nThe changes with each version are documented [here](CHANGELOG.md).\n\n## Upgrade\n\nTo upgrade your pip-installed package to the [latest released version](https://github.com/dkirkby/bayesdesign/releases/latest) use:\n```\npip install bayesdesign --upgrade\n```\n\n## Contributing\n\nIf you have feedback or would like to contribute to this package, please see our [contributor's guide](CONTRIBUTING.md).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Package for Bayesian optimal experimental design",
    "version": "0.4.0",
    "project_urls": {
        "Bug Reports": "https://github.com/dkirkby/bayesdesign/issues",
        "Documentation": "https://github.com/dkirkby/bayesdesign",
        "Homepage": "https://github.com/dkirkby/bayesdesign",
        "Source Code": "https://github.com/dkirkby/bayesdesign"
    },
    "split_keywords": [
        "bayes",
        " optimization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "86624e2cdf9d9c57cd51cbaf29be4f079b8bcb076295661bb40ee941099c7fee",
                "md5": "1aaa97667c8ea76397c3a058eb41321d",
                "sha256": "c5bd57faf8b1b13d6e26fb7202dbd105556133c33e2c0f4a4521eab1c0f5f761"
            },
            "downloads": -1,
            "filename": "bayesdesign-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1aaa97667c8ea76397c3a058eb41321d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10715,
            "upload_time": "2024-09-24T22:40:10",
            "upload_time_iso_8601": "2024-09-24T22:40:10.566271Z",
            "url": "https://files.pythonhosted.org/packages/86/62/4e2cdf9d9c57cd51cbaf29be4f079b8bcb076295661bb40ee941099c7fee/bayesdesign-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e11a550240c13b91e118288347ae15c3e7de9d8f0d2f7e59bd07b9c5d7d86c4d",
                "md5": "50edb2357854b9331cac90c838d9c235",
                "sha256": "16b58664aa165f31c6c14289d407e24f864c874f2a772acbcbaf4d31abdb8b9d"
            },
            "downloads": -1,
            "filename": "bayesdesign-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "50edb2357854b9331cac90c838d9c235",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13697,
            "upload_time": "2024-09-24T22:40:12",
            "upload_time_iso_8601": "2024-09-24T22:40:12.112165Z",
            "url": "https://files.pythonhosted.org/packages/e1/1a/550240c13b91e118288347ae15c3e7de9d8f0d2f7e59bd07b9c5d7d86c4d/bayesdesign-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-24 22:40:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dkirkby",
    "github_project": "bayesdesign",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "bayesdesign"
}
        
Elapsed time: 0.76449s