hyperopt: prettyfie best values when receiving SIGINT, use the global TRIALS

This commit is contained in:
Samuel Husso 2018-01-09 12:37:56 +02:00
parent fe2b0c2862
commit ffae0b2cd5

View File

@ -121,7 +121,7 @@ def read_trials(trials_path=TRIALS_FILE):
def log_trials_result(trials): def log_trials_result(trials):
vals = trials.best_trial['misc']['vals'] vals = json.dumps(trials.best_trial['misc']['vals'], indent=4)
results = trials.best_trial['result']['result'] results = trials.best_trial['result']['result']
logger.info('Best result:\n%s\nwith values:\n%s', results, vals) logger.info('Best result:\n%s\nwith values:\n%s', results, vals)
@ -289,7 +289,7 @@ def start(args):
trials=TRIALS trials=TRIALS
) )
results = sorted(trials.results, key=itemgetter('loss')) results = sorted(TRIALS.results, key=itemgetter('loss'))
best_result = results[0]['result'] best_result = results[0]['result']
except ValueError: except ValueError: