Beispiel #1
0
 def test_ModelListGP_single(self):
     tkwargs = {"device": self.device, "dtype": torch.float}
     train_x1, train_x2, train_y1, train_y2 = _get_random_data(n=10, **tkwargs)
     model1 = SingleTaskGP(train_X=train_x1, train_Y=train_y1)
     model = ModelListGP(model1)
     model.to(**tkwargs)
     test_x = torch.tensor([[0.25], [0.75]], **tkwargs)
     posterior = model.posterior(test_x)
     self.assertIsInstance(posterior, GPyTorchPosterior)
     self.assertIsInstance(posterior.mvn, MultivariateNormal)
Beispiel #2
0
 def test_ModelListGPSingle(self, cuda=False):
     tkwargs = {
         "device": torch.device("cuda") if cuda else torch.device("cpu"),
         "dtype": torch.float,
     }
     train_x1, train_x2, train_y1, train_y2 = _get_random_data(n=10, **tkwargs)
     model1 = SingleTaskGP(train_X=train_x1, train_Y=train_y1)
     model = ModelListGP(gp_models=[model1])
     model.to(**tkwargs)
     test_x = (torch.tensor([0.25, 0.75]).type_as(model.train_targets[0]),)
     posterior = model.posterior(test_x)
     self.assertIsInstance(posterior, GPyTorchPosterior)
     self.assertIsInstance(posterior.mvn, MultivariateNormal)
 def test_ModelListGPSingle(self, cuda=False):
     tkwargs = {
         "device": torch.device("cuda") if cuda else torch.device("cpu"),
         "dtype": torch.float,
     }
     train_x1, train_x2, train_y1, train_y2 = _get_random_data(n=10, **tkwargs)
     model1 = SingleTaskGP(train_X=train_x1, train_Y=train_y1)
     model = ModelListGP(gp_models=[model1])
     model.to(**tkwargs)
     test_x = (torch.tensor([0.25, 0.75]).type_as(model.train_targets[0]),)
     posterior = model.posterior(test_x)
     self.assertIsInstance(posterior, GPyTorchPosterior)
     self.assertIsInstance(posterior.mvn, MultivariateNormal)