„AcquistionFunctions/PreferenceExpectedImprovement.py“ ändern
This commit is contained in:
parent
859ac5bc8f
commit
3f9b12e7f2
@ -12,9 +12,11 @@ class PreferenceExpectedImprovement:
|
||||
self.upper_bound = upper_bound
|
||||
self.lower_bound = lower_bound
|
||||
|
||||
self.initial_variance = 5.0
|
||||
|
||||
self.user_model = None
|
||||
self.proposal_model_mean = np.array((nr_dims, 1))
|
||||
self.proposal_model_covariance = np.diag(np.ones((nr_dims, )) * 5)
|
||||
self.proposal_model_covariance = np.diag(np.ones((nr_dims, )) * self.initial_variance)
|
||||
|
||||
self.rng = np.random.default_rng(seed=seed)
|
||||
|
||||
@ -40,11 +42,19 @@ class PreferenceExpectedImprovement:
|
||||
def expected_improvement(self):
|
||||
pass
|
||||
|
||||
def update_user_preference_model(self):
|
||||
pass
|
||||
def update_user_preference_model(self, preferred_input, preference_array):
|
||||
# Update mean to reflect preferred input
|
||||
self.user_model_mean = preferred_input
|
||||
|
||||
def update_proposal_model(self):
|
||||
pass
|
||||
initial_variance = np.ones((self.nr_dims, )) * self.initial_variance
|
||||
reduced_variance = initial_variance / 10.0
|
||||
variances = np.where(preference_array, reduced_variance, initial_variance)
|
||||
self.user_model_covariance = np.diag(variances)
|
||||
|
||||
def update_proposal_model(self, alpha=0.5):
|
||||
# Update proposal model to be a weighted average of the current proposal model and the user model
|
||||
self.proposal_model_mean = alpha * self.proposal_model_mean + (1 - alpha) * self.user_model_mean
|
||||
self.proposal_model_covariance = alpha * self.proposal_model_covariance + (1 - alpha) * self.user_model_covariance
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user