Ejemplo n.º 1
0
 def test_abstract_raises(self):
     with self.assertRaises(TypeError):
         AnalyticAcquisitionFunction()
     # raise if model is multi-output, but no posterior transform is given
     mean = torch.zeros(1, 2)
     variance = torch.ones(1, 2)
     mm = MockModel(MockPosterior(mean=mean, variance=variance))
     with self.assertRaises(UnsupportedError):
         DummyAnalyticAcquisitionFunction(model=mm)
    def __init__(self, model: Model, options: dict) -> None:
        # MCAcquisitionFunction.__init__(self, model=model, sampler=sampler, objective=IdentityMCObjective())
        AnalyticAcquisitionFunction.__init__(
            self,
            model=model,
            objective=ScalarizedObjective(weights=torch.Tensor([1.0])))
        AcquisitionBaseTools.__init__(self,
                                      model=model,
                                      iden="Xsearch",
                                      Nrestarts_eta=options["Nrestarts_eta"])

        self.u_vec = None
        self.Nsamples_fmin = options["Nsamples_fmin"]
        self.Nrestarts = options["Nrestarts_safe"]
        self.debug = False
        self.method = options["method_safe"]
        self.disp_info_scipy_opti = options["disp_info_scipy_opti"]
        self.dim = self.model.dim
Ejemplo n.º 3
0
 def test_abstract_raises(self):
     with self.assertRaises(TypeError):
         AnalyticAcquisitionFunction()