debugging regular

This commit is contained in:
Niko Feith 2023-06-05 14:56:14 +02:00
parent 334f64e22d
commit 3a8acb6807
3 changed files with 10 additions and 11 deletions

View File

@ -1,13 +1,12 @@
class RegularQuery: class RegularQuery:
def __init__(self, regular): def __init__(self, regular, episode):
self.regular = regular self.regular = int(regular)
self.counter = 0 self.counter = episode
def query(self): def query(self):
if self.counter < self.regular:
self.counter += 1 if self.counter % self.regular == 0 and self.counter != 0:
return False return True
else: else:
self.counter = 0 return False
return True

View File

@ -212,7 +212,7 @@ class ActiveBOTopic(Node):
home_dir = os.path.expanduser('~') home_dir = os.path.expanduser('~')
file_path = os.path.join(home_dir, 'Documents/IntRLResults') file_path = os.path.join(home_dir, 'Documents/IntRLResults')
filename = env + '-' + acq + '-' + self.bo_metric + '-' \ filename = env + '-' + acq + '-' + self.bo_metric + '-' \
+ str(self.bo_metric_parameter) + '-' \ + str(round(self.bo_metric_parameter, 2)) + '-' \
+ str(self.bo_nr_weights) + '-' + str(time.time()) + str(self.bo_nr_weights) + '-' + str(time.time())
filename = filename.replace('.', '_') + '.csv' filename = filename.replace('.', '_') + '.csv'
path = os.path.join(file_path, filename) path = os.path.join(file_path, filename)
@ -251,7 +251,7 @@ class ActiveBOTopic(Node):
user_query = RandomQuery(self.bo_metric_parameter) user_query = RandomQuery(self.bo_metric_parameter)
elif self.bo_metric == "regular": elif self.bo_metric == "regular":
user_query = RegularQuery(self.bo_metric_parameter) user_query = RegularQuery(self.bo_metric_parameter, self.current_episode)
elif self.bo_metric == "max acquisition": elif self.bo_metric == "max acquisition":
user_query = MaxAcqQuery(self.bo_metric_parameter, user_query = MaxAcqQuery(self.bo_metric_parameter,

View File

@ -186,7 +186,7 @@ class ActiveRLService(Node):
if done: if done:
rl_response = ActiveRLResponse() rl_response = ActiveRLResponse()
rl_response.weights = self.rl_weights rl_response.weights = self.eval_weights
rl_response.reward = self.rl_reward rl_response.reward = self.rl_reward
rl_response.final_step = self.rl_step rl_response.final_step = self.rl_step