From cb4a77247b41542bcd04293e7c57464ed3cb1430 Mon Sep 17 00:00:00 2001 From: Martin Fitzner Date: Fri, 31 Jan 2025 11:41:11 +0100 Subject: [PATCH 1/3] Change fit settings --- baybe/surrogates/gaussian_process/core.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/baybe/surrogates/gaussian_process/core.py b/baybe/surrogates/gaussian_process/core.py index b275e409c6..2534f5914c 100644 --- a/baybe/surrogates/gaussian_process/core.py +++ b/baybe/surrogates/gaussian_process/core.py @@ -201,15 +201,19 @@ def _fit(self, train_x: Tensor, train_y: Tensor) -> None: covar_module=covar_module, likelihood=likelihood, ) - mll = gpytorch.ExactMarginalLogLikelihood(self._model.likelihood, self._model) - # TODO: This is a simple temporary workaround to avoid model overfitting - # via early stopping in the presence of task parameters, which currently - # have no prior configured. + # TODO: This is still a temporary workaround to avoid overfitting seen in + # low-dimensional TL cases. More robust settings are being researched. if context.n_task_dimensions > 0: - botorch.optim.fit.fit_gpytorch_mll_torch(mll, step_limit=200) + mll = gpytorch.mlls.LeaveOneOutPseudoLikelihood( + self._model.likelihood, self._model + ) else: - botorch.fit.fit_gpytorch_mll(mll) + mll = gpytorch.ExactMarginalLogLikelihood( + self._model.likelihood, self._model + ) + + botorch.fit.fit_gpytorch_mll(mll) @override def __str__(self) -> str: From 4f48d6b8a356f5ec26f27c5f08a5f481ab986558 Mon Sep 17 00:00:00 2001 From: Martin Fitzner Date: Fri, 31 Jan 2025 11:41:18 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13a8ceccfe..71299a338c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.12.2] - 2025-01-31 +### Changed +- More robust settings for the GP fitting + ## [0.12.1] - 2025-01-29 ### Changed - Default of `allow_recommending_already_recommended` is changed back to `False` From 190bbe9c5012547fb0f863351004025dc0bf6b55 Mon Sep 17 00:00:00 2001 From: Martin Fitzner Date: Fri, 31 Jan 2025 12:08:16 +0100 Subject: [PATCH 3/3] Silence mypy error --- baybe/surrogates/naive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baybe/surrogates/naive.py b/baybe/surrogates/naive.py index d1ec13f536..3912c6b128 100644 --- a/baybe/surrogates/naive.py +++ b/baybe/surrogates/naive.py @@ -37,7 +37,7 @@ def _estimate_moments( import torch # TODO: use target value bounds for covariance scaling when explicitly provided - mean = self._model * torch.ones([len(candidates_comp_scaled)]) + mean = self._model * torch.ones([len(candidates_comp_scaled)]) # type: ignore[operator] var = torch.ones(len(candidates_comp_scaled)) return mean, var