PreferentialBO
(ICML2023) Towards Practical Preferential Bayesian Optimization with Skew Gaussian Processes
Install / Use
/learn @CyberAgentAILab/PreferentialBOREADME
Towards Practical Preferential Bayesian Optimization with Skew Gaussian Processes (ICML2023)
This page provides the python code for preferential Bayesian optimization (BO), which includes experiments in [1].
If you use this codes for research then please cite:
@InProceedings{takeno2023towards,
title = {Towards Practical Preferential {B}ayesian Optimization with Skew {G}aussian Processes},
author = {Takeno, Shion and Nomura, Masahiro and Karasuyama, Masayuki},
booktitle = {Proceedings of the 40th International Conference on Machine Learning},
pages = {33516--33533},
year = {2023},
volume = {202},
series = {Proceedings of Machine Learning Research},
publisher = {PMLR}
}
Environment
- Linux
- We ran the experiments on CentOS 6.9.
- We confirmed the scripts running on Ubuntu 20.04 (latest LTS), but for this environment, we have not confirmed that the result of the paper can be completely reproduced (the difference in OS may produce a slight change in the results).
- Python 3.9.0
- All packages are in requirements.txt
Instruction
-
We implement Gibbs sampling-based preferential Gaussian process regression (GPR) and the preferential BO methods called hallucination believer (HB) with EI and UCB.
-
Organization of the codes:
- EP_Implementation.md: we provide the details of implementation of EP for GPR.
- examples: notebooks for GPR and preferential BO
- GPmodel_comparison: make the illustrative example in the paper (Fig1. in [1])
- PreferentialBO: perform preferential BO using our package.
- experiments: the scripts to reproduce the experiments in the paper [1].
- In an experiment with respect to MCMC, we use the code from [2,3,4]. See README in the folder named ``experiments'' for details.
- src: main modules for preferential BO and GPR for preferential learning.
- test_functions: benchmark functions.
Minimum Example
import numpy as np
from preferentialBO.src.preferential_bayesian_opt import *
model_name = "Gibbs"
first_acq = "current_best"
second_acq = "EI" # for HB-EI
# second_acq = "UCB" # for HB-UCB
# seed for reproducibility
np.random.seed(0)
kernel_lengthscale_bounds = np.array([[1, 1], [10, 10],])
kernel = GPy.kern.RBF(input_dim=2, ARD=True)
# bayesian optimizer
optimizer = PreferentialBO_HallucinationBeliever(
# Left d (=2) columns and right d columns express winners and losers, respectively.
X=np.array([[0, 1, 2, 3], [1, 2, 3, 4]]), # i.e., (0, 1) > (2, 3) and (1, 2) > (3, 4)
x_bounds=np.array([[0, 0], [10, 10]]), # input domain X = [0, 10]^2
kernel=kernel,
kernel_bounds=kernel_lengthscale_bounds,
noise_std=1e-2,
GPmodel=model_name,
)
# marginal likelihood maximization using Laplace approximation
optimizer.GPmodel.model_selection()
# for the continuous X
x1, x2 = optimizer.next_input(first_acq=first_acq, second_acq=second_acq)
# X_all is numpy array (N \times d) for the pool setting
# x1, x2 = optimizer.next_input_pool(first_acq=first_acq, second_acq=second_acq, X=X_all)
print("Selected duel is {} {}".format(x1, x2))
# if x1 > x2, add the new training duel
optimizer.update(X_win=x1, X_loo=x2)
Reference
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
