bayex


Namebayex JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryMinimal Bayesian Optimization Implementation with Gaussian Processes written in JAX.
upload_time2024-02-25 12:48:46
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2021 Albert Alonso Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords jax bayesian-optimization automatic-differentiation gaussian-process machine-learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bayex: Minimal Bayesian Optimization in JAX
[![tests](https://github.com/alonfnt/bayex/actions/workflows/tests.yml/badge.svg)](https://github.com/alonfnt/bayex/actions/workflows/tests.yml)

<p align="center">
    <img src="https://github.com/alonfnt/bayex/assets/38870744/ffb920ed-f347-4185-9abe-24ec2d0a22f1" height="300">
    <img src="https://github.com/alonfnt/bayex/assets/38870744/882fecc7-bc30-4267-ad1d-687fdbbe2cdc" height="300">
</p>

[**Installation**](#installation)
| [**Usage**](#usage)
| [**Contributing**](#contributing)
| [**License**](#license)

Bayex is a lightweight Bayesian optimization library designed for efficiency and flexibility, leveraging the power of JAX for high-performance numerical computations.
This library aims to provide an easy-to-use interface for optimizing expensive-to-evaluate functions through Gaussian Process (GP) models and various acquisition functions. Whether you're maximizing or minimizing your objective function, Bayex offers a simple yet powerful set of tools to guide your search for optimal parameters.

## Installation<a id="installation"></a>
Bayex can be installed using [PyPI](https://pypi.org/project/bayex/) via `pip`:
```
pip install bayex
```
or from GitHub directly
```
pip install git+git://github.com/alonfnt/bayex.git
```

Likewise, you can clone this repository and install it locally

```bash
git clone https://github.com/alonfnt/bayex.git
cd bayex
pip install -r requirements.txt
```

## Usage<a id="usage"></a>
Using Bayex is quite simple despite its low level approach:
```python
import jax
import numpy as np
import bayex

def f(x):
    return -(1.4 - 3 * x) * np.sin(18 * x)

domain = {'x': bayex.domain.Real(0.0, 2.0)}
optimizer = bayex.Optimizer(domain=domain, maximize=True, acq='PI')

# Define some prior evaluations to initialise the GP.
params = {'x': [0.0, 0.5, 1.0]}
ys = [f(x) for x in params['x']
opt_state = optimizer.init(ys, params)

# Sample new points using Jax PRNG approach.
ori_key = jax.random.key(42)
for step in range(20):
    key = jax.random.fold_in(ori_key, step)
    new_params = optimizer.sample(key, opt_state)
    y_new = f(**new_params)
    opt_state = optimizer.fit(opt_state, y_new, new_params)
```

with the results being saved at `opt_state`.

## Contributing<a id="contributing"></a>
We welcome contributions to Bayex! Whether it's adding new features, improving documentation, or reporting issues, please feel free to make a pull request or open an issue.

## License<a id="license"></a>
Bayex is licensed under the MIT License. See the ![LICENSE](LICENSE) file for more details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "bayex",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "jax,bayesian-optimization,automatic-differentiation,gaussian-process,machine-learning",
    "author": "",
    "author_email": "Albert Alonso <alonfnt@pm.me>",
    "download_url": "https://files.pythonhosted.org/packages/a7/6b/6eb814ce568e00003ac8674350c4df913e12a4e334d50b08fb8ed45b3392/bayex-0.2.0.tar.gz",
    "platform": null,
    "description": "# Bayex: Minimal Bayesian Optimization in JAX\n[![tests](https://github.com/alonfnt/bayex/actions/workflows/tests.yml/badge.svg)](https://github.com/alonfnt/bayex/actions/workflows/tests.yml)\n\n<p align=\"center\">\n    <img src=\"https://github.com/alonfnt/bayex/assets/38870744/ffb920ed-f347-4185-9abe-24ec2d0a22f1\" height=\"300\">\n    <img src=\"https://github.com/alonfnt/bayex/assets/38870744/882fecc7-bc30-4267-ad1d-687fdbbe2cdc\" height=\"300\">\n</p>\n\n[**Installation**](#installation)\n| [**Usage**](#usage)\n| [**Contributing**](#contributing)\n| [**License**](#license)\n\nBayex is a lightweight Bayesian optimization library designed for efficiency and flexibility, leveraging the power of JAX for high-performance numerical computations.\nThis library aims to provide an easy-to-use interface for optimizing expensive-to-evaluate functions through Gaussian Process (GP) models and various acquisition functions. Whether you're maximizing or minimizing your objective function, Bayex offers a simple yet powerful set of tools to guide your search for optimal parameters.\n\n## Installation<a id=\"installation\"></a>\nBayex can be installed using [PyPI](https://pypi.org/project/bayex/) via `pip`:\n```\npip install bayex\n```\nor from GitHub directly\n```\npip install git+git://github.com/alonfnt/bayex.git\n```\n\nLikewise, you can clone this repository and install it locally\n\n```bash\ngit clone https://github.com/alonfnt/bayex.git\ncd bayex\npip install -r requirements.txt\n```\n\n## Usage<a id=\"usage\"></a>\nUsing Bayex is quite simple despite its low level approach:\n```python\nimport jax\nimport numpy as np\nimport bayex\n\ndef f(x):\n    return -(1.4 - 3 * x) * np.sin(18 * x)\n\ndomain = {'x': bayex.domain.Real(0.0, 2.0)}\noptimizer = bayex.Optimizer(domain=domain, maximize=True, acq='PI')\n\n# Define some prior evaluations to initialise the GP.\nparams = {'x': [0.0, 0.5, 1.0]}\nys = [f(x) for x in params['x']\nopt_state = optimizer.init(ys, params)\n\n# Sample new points using Jax PRNG approach.\nori_key = jax.random.key(42)\nfor step in range(20):\n    key = jax.random.fold_in(ori_key, step)\n    new_params = optimizer.sample(key, opt_state)\n    y_new = f(**new_params)\n    opt_state = optimizer.fit(opt_state, y_new, new_params)\n```\n\nwith the results being saved at `opt_state`.\n\n## Contributing<a id=\"contributing\"></a>\nWe welcome contributions to Bayex! Whether it's adding new features, improving documentation, or reporting issues, please feel free to make a pull request or open an issue.\n\n## License<a id=\"license\"></a>\nBayex is licensed under the MIT License. See the ![LICENSE](LICENSE) file for more details.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 Albert Alonso  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Minimal Bayesian Optimization Implementation with Gaussian Processes written in JAX.",
    "version": "0.2.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/alonfnt/bayex/issues",
        "Documentation": "https://github.com/alonfnt/bayex",
        "Homepage": "https://github.com/alonfnt/bayex",
        "Source": "https://github.com/alonfnt/bayex"
    },
    "split_keywords": [
        "jax",
        "bayesian-optimization",
        "automatic-differentiation",
        "gaussian-process",
        "machine-learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d193481f09548e520e00f904856c760718da413be5952edee9948da7e21fc3b",
                "md5": "4ab5123da08712be4c9918be22184890",
                "sha256": "3485645bc663dfee3fc4493e46d17d173fddcd15722f3d24ed01c60a52f69802"
            },
            "downloads": -1,
            "filename": "bayex-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4ab5123da08712be4c9918be22184890",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4274,
            "upload_time": "2024-02-25T12:48:44",
            "upload_time_iso_8601": "2024-02-25T12:48:44.683492Z",
            "url": "https://files.pythonhosted.org/packages/5d/19/3481f09548e520e00f904856c760718da413be5952edee9948da7e21fc3b/bayex-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a76b6eb814ce568e00003ac8674350c4df913e12a4e334d50b08fb8ed45b3392",
                "md5": "964a801d58e1303cc8b0971e2844e548",
                "sha256": "33ce9e946103ef281521665d7e2c1676250fc362673590aef649be5edccde365"
            },
            "downloads": -1,
            "filename": "bayex-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "964a801d58e1303cc8b0971e2844e548",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 3736,
            "upload_time": "2024-02-25T12:48:46",
            "upload_time_iso_8601": "2024-02-25T12:48:46.198594Z",
            "url": "https://files.pythonhosted.org/packages/a7/6b/6eb814ce568e00003ac8674350c4df913e12a4e334d50b08fb8ed45b3392/bayex-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-25 12:48:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alonfnt",
    "github_project": "bayex",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "bayex"
}
        
Elapsed time: 0.19056s