Skip to main content

Minimal Bayesian Optimization Implementation with Gaussian Processes written in JAX.

Project description

Bayex: Minimal Bayesian Optimization in JAX

tests

[!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 LICENSE file for more details.

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

bayex-0.2.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

bayex-0.2.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

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

Hashes for bayex-0.2.2.tar.gz
Algorithm Hash digest
SHA256 cf4969672b738eee69fe36d5c6e2b78f34ff6ac9829b9d8e3568d602c1bbe811
MD5 2246b79c4e21931bc46e2755074c7067
BLAKE2b-256 af5a309ec9a3779fbe645321227f967940021bfb3c9955d888a53c55bfe54408

See more details on using hashes here.

Provenance

The following attestation bundles were made for bayex-0.2.2.tar.gz:

Publisher: python-publish.yml on alonfnt/bayex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for bayex-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0529029cb8ab0251f0cc05eaf973b580d31dd8fb83a07199986b81efe0802049
MD5 c8241a6e5da39afa34109a936d39bab8
BLAKE2b-256 e4981219773ff14862d73bbfbd78fb6fd1f3e94fc6df498ac0bb64bfd13fd75f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bayex-0.2.2-py3-none-any.whl:

Publisher: python-publish.yml on alonfnt/bayex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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