Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alonfnt/bayex
Minimal Implementation of Bayesian Optimization in JAX
https://github.com/alonfnt/bayex
automatic-differentiation bayesian-optimization gaussian-process-regression jax python
Last synced: 3 months ago
JSON representation
Minimal Implementation of Bayesian Optimization in JAX
- Host: GitHub
- URL: https://github.com/alonfnt/bayex
- Owner: alonfnt
- License: mit
- Created: 2021-08-01T08:41:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-08T11:15:09.000Z (10 months ago)
- Last Synced: 2024-11-07T09:07:59.546Z (3 months ago)
- Topics: automatic-differentiation, bayesian-optimization, gaussian-process-regression, jax, python
- Language: Python
- Homepage:
- Size: 212 KB
- Stars: 83
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
Awesome Lists containing this project
- awesome-jax - bayex - Bayesian Optimization powered by JAX. <img src="https://img.shields.io/github/stars/alonfnt/bayex?style=social" align="center"> (Libraries / New Libraries)
- awesome-jax - bayex - Minimal Implementation of Bayesian Optimization in JAX. <img src="https://img.shields.io/github/stars/alonfnt/bayex?style=social" align="center"> (Libraries)
- awesome-jax - bayex - Minimal Implementation of Bayesian Optimization in JAX. <img src="https://img.shields.io/github/stars/alonfnt/bayex?style=social" align="center"> (Libraries)
README
# 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)
>[!NOTE]
>Bayex is currently a minimal, personally developed implementation that requires further development for broader application. If you're interested in engaging with Jax and enhancing Bayex, your contributions would be highly welcomed and appreciated.
![]()
![]()
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
Bayex can be installed using [PyPI](https://pypi.org/project/bayex/) via `pip`:
```
pip install bayex
```## Usage
Using Bayex is quite simple despite its low level approach:
```python
import jax
import numpy as np
import bayexdef 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
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
Bayex is licensed under the MIT License. See the ![LICENSE](LICENSE) file for more details.