Minimal Bayesian Optimization Implementation with Gaussian Processes written in JAX.
Project description
Bayex: Minimal Bayesian Optimization in JAX
[!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 via pip
:
pip install bayex
Usage
Using Bayex is quite simple despite its low level approach:
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
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 file for more details.
Project details
Release history Release notifications | RSS feed
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 bayex-0.2.2.tar.gz
.
File metadata
- Download URL: bayex-0.2.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
cf4969672b738eee69fe36d5c6e2b78f34ff6ac9829b9d8e3568d602c1bbe811
|
|
MD5 |
2246b79c4e21931bc46e2755074c7067
|
|
BLAKE2b-256 |
af5a309ec9a3779fbe645321227f967940021bfb3c9955d888a53c55bfe54408
|
Provenance
The following attestation bundles were made for bayex-0.2.2.tar.gz
:
Publisher:
python-publish.yml
on alonfnt/bayex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
bayex-0.2.2.tar.gz
-
Subject digest:
cf4969672b738eee69fe36d5c6e2b78f34ff6ac9829b9d8e3568d602c1bbe811
- Sigstore transparency entry: 161211371
- Sigstore integration time:
-
Permalink:
alonfnt/bayex@5ef2dcc10c0124fd830058d24eb5e56631ab8f88
-
Branch / Tag:
refs/heads/upgrade-version-2.0.1
- Owner: https://github.com/alonfnt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python-publish.yml@5ef2dcc10c0124fd830058d24eb5e56631ab8f88
-
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file bayex-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: bayex-0.2.2-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
0529029cb8ab0251f0cc05eaf973b580d31dd8fb83a07199986b81efe0802049
|
|
MD5 |
c8241a6e5da39afa34109a936d39bab8
|
|
BLAKE2b-256 |
e4981219773ff14862d73bbfbd78fb6fd1f3e94fc6df498ac0bb64bfd13fd75f
|
Provenance
The following attestation bundles were made for bayex-0.2.2-py3-none-any.whl
:
Publisher:
python-publish.yml
on alonfnt/bayex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
bayex-0.2.2-py3-none-any.whl
-
Subject digest:
0529029cb8ab0251f0cc05eaf973b580d31dd8fb83a07199986b81efe0802049
- Sigstore transparency entry: 161211373
- Sigstore integration time:
-
Permalink:
alonfnt/bayex@5ef2dcc10c0124fd830058d24eb5e56631ab8f88
-
Branch / Tag:
refs/heads/upgrade-version-2.0.1
- Owner: https://github.com/alonfnt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
python-publish.yml@5ef2dcc10c0124fd830058d24eb5e56631ab8f88
-
Trigger Event:
workflow_dispatch
-
Statement type: