Skip to content

Commit 77addf5

Browse files
Daniel Jiangfacebook-github-bot
authored andcommitted
fix seed to make Heteroskedastic SingleTaskGP test less flaky
Summary: see title Reviewed By: Balandat Differential Revision: D18821169 fbshipit-source-id: d4c496e1f871cce6386faaf288452bc1b0b5d76c
1 parent 6756531 commit 77addf5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/models/test_gp_regression.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from botorch.models.utils import add_output_dim
2020
from botorch.posteriors import GPyTorchPosterior
2121
from botorch.sampling import SobolQMCNormalSampler
22+
from botorch.utils.sampling import manual_seed
2223
from botorch.utils.testing import BotorchTestCase, _get_random_data
2324
from gpytorch.kernels import MaternKernel, ScaleKernel
2425
from gpytorch.likelihoods import (
@@ -284,9 +285,10 @@ def test_fixed_noise_likelihood(self):
284285

285286
class TestHeteroskedasticSingleTaskGP(TestSingleTaskGP):
286287
def _get_model_and_data(self, batch_shape, m, outcome_transform=None, **tkwargs):
287-
train_X, train_Y = _get_random_data(
288-
batch_shape=batch_shape, num_outputs=m, **tkwargs
289-
)
288+
with manual_seed(0):
289+
train_X, train_Y = _get_random_data(
290+
batch_shape=batch_shape, num_outputs=m, **tkwargs
291+
)
290292
train_Yvar = (0.1 + 0.1 * torch.rand_like(train_Y)) ** 2
291293
model_kwargs = {
292294
"train_X": train_X,

0 commit comments

Comments
 (0)