Skip to content

LNSGroup/StageOpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StageOpt: Stagewise Safe Bayesian Optimization with Gaussian Processes

Overview

StageOpt is an algorithm for optimizing black-box functions based on SafeOpt. It divides the optimization process into two stages: safe region expansion and utility function maximization, thereby satisfying safety constraints while approximating the optimal point.

This repository provides an implementation of the StageOpt algorithm proposed in the following paper:

Stagewise Safe Bayesian Optimization with Gaussian Processes
Yanan Sui, Vincent Zhuang, Joel Burdick, Yisong Yue
International Conference on Machine Learning (ICML), 2018
PDF

Demo

1d example for StageOpt
The safe set (green bar), expanders (blue bar).

Installation

Python = 3.13

pip install -r requirements.txt && pip install -e .

Usage

To get started, it is recommended to run the interactive notebooks in the examples folder. We provide 1-d and 2-d examples for the algorithm.

An example for 1-d:

import torch
from stageopt import StageOpt

# Initialization
candidates = torch.linspace(0, 10, 100).unsqueeze(-1)
bounds = torch.tensor([[0.], [10.]])
train_X = candidates[[40, 70]]
train_Y = torch.tensor([[1.0, 0.3], [1.5, 0.8]])  # [objective, constraint]
fmin = torch.tensor([0.2])
lipschitz = torch.tensor([0.5])

algo = StageOpt(
    candidates=candidates,
    bounds=bounds,
    train_X=train_X,
    train_Y=train_Y,
    num_objectives=1,
    num_constraints=1,
    fmin=fmin,
    switch_time=10,
    lipschitz=lipschitz,
    covar_module=None,  # Use default RBF kernel
    ci_beta=2.0,
    enable_fit=False,
)

# Optimization
for _ in range(20):
    x_next = algo.next()
    if x_next is None: break
    y_next = your_function(x_next)   # Return [objective, constraint]
    algo.update(x_next, y_next)

BibTex

@InProceedings{pmlr-v80-sui18a,
  title={Stagewise Safe {B}ayesian Optimization with {G}aussian Processes},
  author={Sui, Yanan and Zhuang, Vincent and Burdick, Joel and Yue, Yisong},
  booktitle={Proceedings of the 35th International Conference on Machine Learning},
  year={2018}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages