mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 04:03:55 +00:00
reuse pool workers
This commit is contained in:
parent
0cb1aedf5b
commit
a46badd5c0
|
@ -308,13 +308,12 @@ class Hyperopt(Backtesting):
|
||||||
'result': result_explanation,
|
'result': result_explanation,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return loss
|
|
||||||
|
|
||||||
# return {
|
return {
|
||||||
# 'loss': loss,
|
'loss': loss,
|
||||||
# 'status': STATUS_OK,
|
'status': STATUS_OK,
|
||||||
# 'result': result_explanation,
|
'result': result_explanation,
|
||||||
# }
|
}
|
||||||
|
|
||||||
def format_results(self, results: DataFrame) -> str:
|
def format_results(self, results: DataFrame) -> str:
|
||||||
"""
|
"""
|
||||||
|
@ -374,12 +373,13 @@ class Hyperopt(Backtesting):
|
||||||
|
|
||||||
opt = Optimizer(self.hyperopt_space(), "ET", acq_optimizer="sampling")
|
opt = Optimizer(self.hyperopt_space(), "ET", acq_optimizer="sampling")
|
||||||
|
|
||||||
|
with Parallel(n_jobs=-1) as parallel:
|
||||||
for i in range(self.total_tries//cpus):
|
for i in range(self.total_tries//cpus):
|
||||||
asked = opt.ask(n_points=cpus)
|
asked = opt.ask(n_points=cpus)
|
||||||
#asked = opt.ask()
|
#asked = opt.ask()
|
||||||
#f_val = self.generate_optimizer(asked)
|
#f_val = self.generate_optimizer(asked)
|
||||||
f_val = Parallel(n_jobs=-1)(delayed(self.generate_optimizer)(v) for v in asked)
|
f_val = parallel(delayed(self.generate_optimizer)(v) for v in asked)
|
||||||
opt.tell(asked, f_val)
|
opt.tell(asked, [i['loss'] for i in f_val])
|
||||||
print(f'got value {f_val}')
|
print(f'got value {f_val}')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user