Skip to content

Commit 0cb0aa1

Browse files
saitcakmakfacebook-github-bot
authored andcommitted
Replace usage of deprecated FixedNoiseGP with SingleTaskGP
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
1 parent 72db366 commit 0cb0aa1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

test/acquisition/test_logei.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
from botorch.exceptions import BotorchWarning, UnsupportedError
4545
from botorch.exceptions.errors import BotorchError
4646
from botorch.models import ModelListGP, SingleTaskGP
47-
from botorch.models.gp_regression import FixedNoiseGP
4847
from botorch.sampling.normal import IIDNormalSampler, SobolQMCNormalSampler
4948
from botorch.utils.low_rank import sample_cached_cholesky
5049
from botorch.utils.testing import BotorchTestCase, MockModel, MockPosterior
@@ -738,7 +737,7 @@ def test_is_log(self):
738737

739738
# single objective case
740739
X, Y = torch.rand(3, 2), torch.randn(3, 1)
741-
model = FixedNoiseGP(train_X=X, train_Y=Y, train_Yvar=torch.rand_like(Y))
740+
model = SingleTaskGP(train_X=X, train_Y=Y, train_Yvar=torch.rand_like(Y))
742741

743742
# (q)LogEI
744743
for acqf_class in [LogExpectedImprovement, qLogExpectedImprovement]:

test_community/models/test_gp_regression_multisource.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from botorch import fit_gpytorch_mll
1414
from botorch.exceptions import InputDataError, OptimizationWarning
15-
from botorch.models import FixedNoiseGP, SingleTaskGP
15+
from botorch.models import SingleTaskGP
1616
from botorch.models.transforms import Normalize, Standardize
1717
from botorch.posteriors import GPyTorchPosterior
1818
from botorch.sampling import SobolQMCNormalSampler
@@ -238,14 +238,14 @@ def test_condition_on_observations(self):
238238
)
239239
c_kwargs = (
240240
{"noise": torch.full_like(Y_fant, 0.01)}
241-
if isinstance(model, FixedNoiseGP)
241+
if isinstance(model.likelihood, FixedNoiseGaussianLikelihood)
242242
else {}
243243
)
244244
cm = model.condition_on_observations(X_fant, Y_fant, **c_kwargs)
245245
# fantasize at same input points (check proper broadcasting)
246246
c_kwargs_same_inputs = (
247247
{"noise": torch.full_like(Y_fant[0], 0.01)}
248-
if isinstance(model, FixedNoiseGP)
248+
if isinstance(model.likelihood, FixedNoiseGaussianLikelihood)
249249
else {}
250250
)
251251
cm_same_inputs = model.condition_on_observations(

0 commit comments

Comments
 (0)