Skip to content

Commit

Permalink
Replace usage of deprecated FixedNoiseGP with SingleTaskGP
Browse files Browse the repository at this point in the history
Summary: Cleans up usage of fixed noise models. The only remaining usage is in the Ax storage for backwards compatibility and in the corresponding test files for the deprecated classes.

Reviewed By: Balandat

Differential Revision: D56794557

fbshipit-source-id: fafe9d4d212d2d3343241a38ae1f56ba37c6edbe
  • Loading branch information
saitcakmak authored and facebook-github-bot committed May 1, 2024
1 parent 72db366 commit 0cb0aa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions test/acquisition/test_logei.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
from botorch.exceptions import BotorchWarning, UnsupportedError
from botorch.exceptions.errors import BotorchError
from botorch.models import ModelListGP, SingleTaskGP
from botorch.models.gp_regression import FixedNoiseGP
from botorch.sampling.normal import IIDNormalSampler, SobolQMCNormalSampler
from botorch.utils.low_rank import sample_cached_cholesky
from botorch.utils.testing import BotorchTestCase, MockModel, MockPosterior
Expand Down Expand Up @@ -738,7 +737,7 @@ def test_is_log(self):

# single objective case
X, Y = torch.rand(3, 2), torch.randn(3, 1)
model = FixedNoiseGP(train_X=X, train_Y=Y, train_Yvar=torch.rand_like(Y))
model = SingleTaskGP(train_X=X, train_Y=Y, train_Yvar=torch.rand_like(Y))

# (q)LogEI
for acqf_class in [LogExpectedImprovement, qLogExpectedImprovement]:
Expand Down
6 changes: 3 additions & 3 deletions test_community/models/test_gp_regression_multisource.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from botorch import fit_gpytorch_mll
from botorch.exceptions import InputDataError, OptimizationWarning
from botorch.models import FixedNoiseGP, SingleTaskGP
from botorch.models import SingleTaskGP
from botorch.models.transforms import Normalize, Standardize
from botorch.posteriors import GPyTorchPosterior
from botorch.sampling import SobolQMCNormalSampler
Expand Down Expand Up @@ -238,14 +238,14 @@ def test_condition_on_observations(self):
)
c_kwargs = (
{"noise": torch.full_like(Y_fant, 0.01)}
if isinstance(model, FixedNoiseGP)
if isinstance(model.likelihood, FixedNoiseGaussianLikelihood)
else {}
)
cm = model.condition_on_observations(X_fant, Y_fant, **c_kwargs)
# fantasize at same input points (check proper broadcasting)
c_kwargs_same_inputs = (
{"noise": torch.full_like(Y_fant[0], 0.01)}
if isinstance(model, FixedNoiseGP)
if isinstance(model.likelihood, FixedNoiseGaussianLikelihood)
else {}
)
cm_same_inputs = model.condition_on_observations(
Expand Down

0 comments on commit 0cb0aa1

Please sign in to comment.