From 89f1e1afb9d1c637eadda31e430ea9ae078b0b2d Mon Sep 17 00:00:00 2001 From: Harry Slatyer Date: Sun, 4 Dec 2016 11:04:03 +1100 Subject: [PATCH] Set new_params_event in MLC after getting the cost When generation_num=1, if the new_params_event is set first then the learner will try to get the cost when the queue is empty, causing an exception. --- mloop/controllers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mloop/controllers.py b/mloop/controllers.py index 0db4a2a..8cf527e 100644 --- a/mloop/controllers.py +++ b/mloop/controllers.py @@ -714,13 +714,14 @@ def _optimization_routine(self): super(MachineLearnerController,self)._put_params_and_out_dict(next_params, param_type=self.machine_learner_type) ml_consec += 1 ml_count += 1 + + self.save_archive() + self._get_cost_and_in_dict() + if ml_count==self.generation_num: self.new_params_event.set() ml_count = 0 - - self.save_archive() - self._get_cost_and_in_dict() def _shut_down(self):