From 366ac26e968507d57b94274b51fe58383dc62d32 Mon Sep 17 00:00:00 2001 From: Naoto Mizuno Date: Thu, 5 Oct 2023 15:46:52 +0900 Subject: [PATCH 1/4] Add PreferentialGPSampler document --- docs/api.rst | 1 + optuna_dashboard/preferential/samplers/gp.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index 18f8bc72..e26dcfd6 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -44,6 +44,7 @@ Preferential Optimization optuna_dashboard.preferential.create_study optuna_dashboard.preferential.load_study optuna_dashboard.preferential.PreferentialStudy + optuna_dashboard.preferential.samplers.gp.PreferentialGPSampler optuna_dashboard.register_preference_feedback_component Streamlit diff --git a/optuna_dashboard/preferential/samplers/gp.py b/optuna_dashboard/preferential/samplers/gp.py index cb03fb8f..b1234991 100644 --- a/optuna_dashboard/preferential/samplers/gp.py +++ b/optuna_dashboard/preferential/samplers/gp.py @@ -280,6 +280,25 @@ class _PreferentialGP: class PreferentialGPSampler(optuna.samplers.BaseSampler): + """Sampler for preferential optimization using Gaussian process. + + The sampling algorithm is based on `Takeno et al., 2023 `_. + This sampler uses BoTorch to optimize acquisition function. + + Args: + kernel: + Kernel that computes the covariance on the Gaussian process. + noise_prior: + Prior of the observation noise. + independent_sampler: + A :class:`~optuna.samplers.BaseSampler` instance that is used for independent + sampling. The parameters not contained in the relative search space are sampled + by this sampler. If :obj:`None` is specified, + :class:`~optuna.samplers.RandomSampler` is used as the default. + seed: + Seed for random number generator. + """ + def __init__( self, *, From 09fa32b9141e97aef875f2cc610880af288da778 Mon Sep 17 00:00:00 2001 From: Naoto Mizuno Date: Thu, 5 Oct 2023 17:10:43 +0900 Subject: [PATCH 2/4] Install BoTorch on document build --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4eff6f1f..9d8500dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ dynamic = ["version"] [project.optional-dependencies] docs = [ "boto3", + "botorch", "streamlit", "sphinx", "sphinx_rtd_theme", From 20091d2616083a8c96b8086ce4316f549078b4a3 Mon Sep 17 00:00:00 2001 From: Naoto Mizuno Date: Fri, 6 Oct 2023 13:47:47 +0900 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: contramundum53 --- optuna_dashboard/preferential/samplers/gp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/optuna_dashboard/preferential/samplers/gp.py b/optuna_dashboard/preferential/samplers/gp.py index b1234991..5edf6454 100644 --- a/optuna_dashboard/preferential/samplers/gp.py +++ b/optuna_dashboard/preferential/samplers/gp.py @@ -287,9 +287,9 @@ class PreferentialGPSampler(optuna.samplers.BaseSampler): Args: kernel: - Kernel that computes the covariance on the Gaussian process. + Kernel that computes the covariance on the Gaussian process. Defaults to Matern 3/2 Kernel + ARD. noise_prior: - Prior of the observation noise. + Prior of the observation noise. Defaults to gamma prior. independent_sampler: A :class:`~optuna.samplers.BaseSampler` instance that is used for independent sampling. The parameters not contained in the relative search space are sampled From bef3d1e57e4d612883a1db8ce6a7df8293ca2c63 Mon Sep 17 00:00:00 2001 From: Naoto Mizuno Date: Fri, 6 Oct 2023 13:54:40 +0900 Subject: [PATCH 4/4] Fix lint --- optuna_dashboard/preferential/samplers/gp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/optuna_dashboard/preferential/samplers/gp.py b/optuna_dashboard/preferential/samplers/gp.py index 5edf6454..7815a365 100644 --- a/optuna_dashboard/preferential/samplers/gp.py +++ b/optuna_dashboard/preferential/samplers/gp.py @@ -287,7 +287,8 @@ class PreferentialGPSampler(optuna.samplers.BaseSampler): Args: kernel: - Kernel that computes the covariance on the Gaussian process. Defaults to Matern 3/2 Kernel + ARD. + Kernel that computes the covariance on the Gaussian process. Defaults to + Matern 3/2 Kernel + ARD. noise_prior: Prior of the observation noise. Defaults to gamma prior. independent_sampler: