From 2126150da18b3e8e2322a344014dfcf4a4b4ac50 Mon Sep 17 00:00:00 2001 From: Harry Slatyer Date: Fri, 2 Dec 2016 16:23:32 +1100 Subject: [PATCH] More NNController tidying/tweaking --- mloop/learners.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mloop/learners.py b/mloop/learners.py index 92b5e44..40f983d 100644 --- a/mloop/learners.py +++ b/mloop/learners.py @@ -1125,6 +1125,7 @@ def wait_for_new_params_event(self): ''' Waits for a new parameters event and starts a new parameter generation cycle. Also checks end event and will break if it is triggered. ''' + self.log.debug("Waiting for new params") while not self.end_event.is_set(): if self.new_params_event.wait(timeout=self.learner_wait): self.new_params_event.clear() @@ -1487,6 +1488,7 @@ class NeuralNetLearner(Learner, mp.Process): predict_local_minima_at_end (Optional [bool]): If True finds all minima when the learner is ended. Does not if False. Default False. Attributes: + TODO: Update these. all_params (array): Array containing all parameters sent to learner. all_costs (array): Array containing all costs sent to learner. all_uncers (array): Array containing all uncertainties sent to learner. @@ -1588,6 +1590,15 @@ def __init__(self, self.noise_level = 1 self.neural_net_impl = NeuralNetImpl(self.num_params) + # TODO: What are these? + self.generation_num = 4 + if (self.default_bad_cost is None) and (self.default_bad_uncertainty is None): + self.bad_defaults_set = False + elif (self.default_bad_cost is not None) and (self.default_bad_uncertainty is not None): + self.bad_defaults_set = True + else: + self.log.error('Both the default cost and uncertainty must be set for a bad run or they must both be set to None.') + raise ValueError self.archive_dict.update({'archive_type':'neural_net_learner', 'bad_run_indexs':self.bad_run_indexs, @@ -1792,10 +1803,10 @@ def run(self): try: while not self.end_event.is_set(): - #self.log.debug('Learner waiting for new params event') + self.log.debug('Learner waiting for new params event') self.save_archive() self.wait_for_new_params_event() - #self.log.debug('Gaussian process learner reading costs') + self.log.debug('NN learner reading costs') self.get_params_and_costs() self.fit_neural_net() for _ in range(self.generation_num):