Skip to content

Commit

Permalink
add test to ensure ModelListGP works with only noise and no mask
Browse files Browse the repository at this point in the history
  • Loading branch information
swierh committed Feb 6, 2025
1 parent b7d0570 commit 95a90f1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/models/test_model_list_gp_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,27 @@ def test_fantasize(self):
(3, 2), 0.3, dtype=x1.dtype, device=x1.device
)
observation_noise[:, 1] = 0.4

# check observation noise without mask
fm = modellist.fantasize(
torch.rand(3, 2),
sampler=ListSampler(sampler1, sampler2),
observation_noise=observation_noise,
)
for i in range(2):
fm_i = fm.models[i]
self.assertIsInstance(fm_i, SingleTaskGP)
self.assertIsInstance(fm_i.likelihood, FixedNoiseGaussianLikelihood)
self.assertEqual(fm_i.train_inputs[0].shape, torch.Size([2, 8, 2]))
self.assertEqual(fm_i.train_targets.shape, torch.Size([2, 8]))
# check observation_noise
self.assertTrue(
torch.equal(
fm_i.likelihood.noise[..., -3:], observation_noise[:, i]
)
)

# check masked noise
for obs_noise in (None, observation_noise):
fm = modellist.fantasize(
torch.rand(3, 2),
Expand Down

0 comments on commit 95a90f1

Please sign in to comment.