pretty print hyperopt results
This commit is contained in:
parent
7f3f127165
commit
a23fce519d
@ -1,9 +1,12 @@
|
|||||||
# pragma pylint: disable=missing-docstring,W0212
|
# pragma pylint: disable=missing-docstring,W0212
|
||||||
|
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from math import exp
|
from math import exp
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
from hyperopt import fmin, tpe, hp, Trials, STATUS_OK
|
from hyperopt import fmin, tpe, hp, Trials, STATUS_OK
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
@ -176,7 +179,7 @@ def start(args):
|
|||||||
|
|
||||||
trials = Trials()
|
trials = Trials()
|
||||||
best = fmin(fn=optimizer, space=SPACE, algo=tpe.suggest, max_evals=TOTAL_TRIES, trials=trials)
|
best = fmin(fn=optimizer, space=SPACE, algo=tpe.suggest, max_evals=TOTAL_TRIES, trials=trials)
|
||||||
print('\n\n\n\n==================== HYPEROPT BACKTESTING REPORT ==============================')
|
print('\n==================== HYPEROPT BACKTESTING REPORT ==============================\n')
|
||||||
print('Best parameters {}'.format(best))
|
print('Best parameters: {}'.format(json.dumps(best, indent=4)))
|
||||||
newlist = sorted(trials.results, key=itemgetter('loss'))
|
results = sorted(trials.results, key=itemgetter('loss'))
|
||||||
print('Result: {}'.format(newlist[0]['result']))
|
print('Best Result: {}\n'.format(results[0]['result']))
|
||||||
|
Loading…
Reference in New Issue
Block a user