commit c8ef335cb20081ffb74df220bae9540b7b660a46
parent 229e6053bce50820613f28875b84c28c5e287bbb
Author: Étienne Simon <esimon@esimon.eu>
Date: Wed, 18 Jun 2014 14:15:04 +0200
Add option to train a meta-model in a single thread
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meta_model.py b/meta_model.py
@@ -65,7 +65,7 @@ class Meta_model(object):
""" Train the model. """
if len(self.models)==1:
self.models[0].train()
- else:
+ else if 'threaded' in self.config and self.config['threaded']:
threads = [ threading.Thread(target=model.train, args=()) for model in self.models ]
for (model, thread) in zip(self.models, threads):
log('# Starting thread for model {0}\n'.format(model.tag))
@@ -74,3 +74,6 @@ class Meta_model(object):
for thread in threads:
thread.join()
log('# All children joined\n')
+ else:
+ for model in self.models:
+ model.train()