„AcquistionFunctions/PreferenceExpectedImprovement.py“ ändern

This commit is contained in:
Niko Feith 2023-07-12 17:56:20 +00:00
parent e9f24d0086
commit 859ac5bc8f

View File

@ -22,10 +22,19 @@ class PreferenceExpectedImprovement:
pass
def rejection_sampling(self):
samples = np.empty((self.nr_samples, self.nr_dims))
i = 0
while i < self.nr_samples:
pass
samples = np.empty((0, self.nr_dims))
while samples.shape[0] < self.nr_samples:
# sample from the multi variate gaussian distribution
sample = self.rng.multivariate_normal(
self.proposal_model_mean,
self.proposal_model_covariance
)
# check if the sample is within the bounds
if np.all(sample >= self.lower_bound) and np.all(sample <= self.upper_bound):
samples = np.append(samples, [sample], axis=0)
return samples
def expected_improvement(self):