Optimizing Posterior Samples for Bayesian Optimization via Rootfinding
Reason this release was yanked:
dependencies breakage
Project description
TSRoots
A Python Package for Efficient Global Optimization of Posterior-Based Acquisition Functions via Rootfinding in Bayesian Optimization
Bayesian Optimization (BO) uses acquisition functions as surrogates for expensive objective functions.
Thompson Sampling, a popular BO strategy, optimizes posterior samples to guide exploration and exploitation.
However, optimizing these samples can be complex and computationally challenging.
TSRoots streamlines this process by leveraging the separability of the multivariate Gaussian Process prior and a decoupled representation of the posterior. Integrated with advanced root-finding techniques, TSRoots efficiently selects starting points for gradient-based multistart optimization. This results in higher-quality solutions for posterior sample-based acquisition functions, enabling robust performance in both low- and high-dimensional settings.
Installation
Requirements
- Python >= 3.7
- PyTorch
- chebpy
Requirments Installation Dependencies
Some required dependencies, such as torch and chebpy are not installed by default.
- To install PyTorch,
we recommend installing the appropriate version of PyTorch for your system by following the instructions here:
PyTorch Installation Instructions. Although least preferd, you can directly
install for CPU version by running
pip install torch. - To install ChebPy, you can see installation instructions here:
Chepy Installation Instructions. You can also directly
install cheby via
pip install git+https://github.com/chebpy/chebpy.git
Once the above requirements have been satisfied, you can install the TSRoots package in various ways: using pip,conda, or directly from Github.
Lightweight Installation of TSRoots
Using pip:
pip install tsroots
Via conda:
conda install -c conda-forge tsroots
Development Version
If you are contributing a pull request or for a full installation with examples, tests, and the latest updates, it is best to perform a manual installation:
git clone https://github.com/your_username/TS-roots.git
cd TS-roots
pip install -e .[docs,pytorch,test]
pip install git+https://github.com/chebpy/chebpy.git # Install Chebpy from git
To verify correct installation, you can run on the test suite on your terminal via:
python shell/run_all_tests.py
Quick Start
This example demonstrates the core functionality of TS_roots to generate new points for Bayesian Optimization using normalized data and gradient-based rootfinding techniques. For a more detailed overview of model fitting, rootfinding, decoupled GP representation, and BO implementation including generating the dynamic plot above, check out the Getting Started Notebook.
import numpy as np
from tsroots.optim import TSRoots
from tsroots.utils import generate_Xdata, generate_Ydata
# Define the objective function
def f_objective_example(x):
return x * np.sin(x)
# Define bounds and generate sample data
lb_x_physical = np.array([-15])
ub_x_physical = np.array([15])
no_sample = 5
D = 1
seed = 42
# Generate initial samples and normalize them
X_physical_space, X_normalized = generate_Xdata(no_sample, D, seed, lb_x_physical, ub_x_physical)
Y_physical_space, Y_normalized = generate_Ydata(f_objective_example, X_physical_space)
# Instantiate and use TSRoots for optimization
TSRoots_BO = TSRoots(X_normalized, Y_normalized.flatten(), -np.ones(D), np.ones(D))
x_new_normalized, y_new_normalized, _ = TSRoots_BO.xnew_TSroots()
print(f"New observation location: {x_new_normalized}")
print(f"New function value: {y_new_normalized}")
Citation
If you found TSRoots helpful, please cite the following paper:
@inproceedings{
adebiyi2024gaussian,
title={Gaussian Process Thompson Sampling via Rootfinding},
author={Taiwo Adebiyi and Bach Do and Ruda Zhang},
booktitle={NeurIPS 2024 Workshop on Bayesian Decision-making and Uncertainty},
year={2024},
url={https://openreview.net/forum?id=IpRLTVblaV}
}
The Team
TSRoots is produced by the Uncertainty Quantification Lab at the University of Houston; the primary maintainers are:
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsroots-0.1.1.tar.gz.
File metadata
- Download URL: tsroots-0.1.1.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16eee9f8f085bdea418d5d620746cbeaaa1ead8cc1c0efeafb4b37ed187a2e0d
|
|
| MD5 |
26276900f2c3e824d4f09c187458aabd
|
|
| BLAKE2b-256 |
655cda9e473000212cf259eec5160f085e37e3dbfce159ff93b3e5ca0d3563c8
|
File details
Details for the file tsroots-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tsroots-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60a609bc0f6073a404d9fb7bdb893afc52c33e0bb26bb77fd4b43d8c5e085d5c
|
|
| MD5 |
6bc65422f6077e1016b1734fe6654a6c
|
|
| BLAKE2b-256 |
af2241db678a1a565b7ea70358e23141b92f9ebcd22782e6408daefd87323de8
|