run at least one epoch

This commit is contained in:
Janne Sinivirta 2018-07-03 21:54:32 +03:00
parent 2cde540645
commit 3a7056ea1b

View File

@ -361,9 +361,10 @@ class Hyperopt(Backtesting):
logger.info(f'Found {cpus} CPU cores. Let\'s make them scream!')
opt = self.get_optimizer(cpus)
EVALS = max(self.total_tries//cpus, 1)
try:
with Parallel(n_jobs=cpus) as parallel:
for i in range(self.total_tries//cpus):
for i in range(EVALS):
asked = opt.ask(n_points=cpus)
f_val = self.run_optimizer_parallel(parallel, asked)
opt.tell(asked, [i['loss'] for i in f_val])