def update(self, model): self.model = model self.sn2 = self.model.get_noise() self.sample_representer_points() mu, var = self.model.predict(np.array(self.zb), full_cov=True) self.logP, self.dlogPdMu, self.dlogPdSigma, self.dlogPdMudMu = \ epmgp.joint_min(mu, var, with_derivatives=True) self.W = scipy.stats.norm.ppf( np.linspace(1. / (self.Np + 1), 1 - 1. / (self.Np + 1), self.Np))[np.newaxis, :] self.logP = np.reshape(self.logP, (self.logP.shape[0], 1))
def update(self, model): self.model = model self.sn2 = self.model.get_noise() self.sample_representer_points() mu, var = self.model.predict(np.array(self.zb), full_cov=True) self.logP, self.dlogPdMu, self.dlogPdSigma, self.dlogPdMudMu = \ epmgp.joint_min(mu, var, with_derivatives=True) self.W = scipy.stats.norm.ppf(np.linspace(1. / (self.Np + 1), 1 - 1. / (self.Np + 1), self.Np))[np.newaxis, :] self.logP = np.reshape(self.logP, (self.logP.shape[0], 1))
def test_compute_pmin(self): # Uniform distribution m = np.ones([self.acquisition_func.Nb, 1]) v = np.eye(self.acquisition_func.Nb) pmin = epmgp.joint_min(m, v) pmin = np.exp(pmin) uprob = 1. / self.acquisition_func.Nb assert pmin.shape[0] == self.acquisition_func.Nb assert np.any(pmin < (uprob + 0.03)) and np.any(pmin > uprob - 0.01) # Dirac delta m = np.ones([self.acquisition_func.Nb, 1]) * 1000 m[0] = 1 v = np.eye(self.acquisition_func.Nb) pmin = epmgp.joint_min(m, v) pmin = np.exp(pmin) uprob = 1. / self.acquisition_func.Nb assert pmin[0] == 1.0 assert np.any(pmin[:1] > 1e-10)