def test_sample_max_value_Thompson(self): for dtype in (torch.float, torch.double): torch.manual_seed(7) mm = MESMockModel() candidate_set = torch.rand(3, 10, 2, dtype=dtype) samples = _sample_max_value_Thompson(mm, candidate_set, 5) self.assertEqual(samples.shape, torch.Size([5, 3])) # Test with multi-output model w/ transform. mm = MESMockModel(num_outputs=2) pt = ScalarizedPosteriorTransform(weights=torch.ones(2, dtype=dtype)) samples = _sample_max_value_Thompson( mm, candidate_set, 5, posterior_transform=pt ) self.assertEqual(samples.shape, torch.Size([5, 3]))
def test_sample_max_value_Thompson(self): for dtype in (torch.float, torch.double): torch.manual_seed(7) mm = MESMockModel() candidate_set = torch.rand(3, 10, 2, dtype=dtype) samples = _sample_max_value_Thompson(mm, candidate_set, 5) self.assertEqual(samples.shape, torch.Size([5, 3]))