Remove old print option for hyperopt-list and made table as default

This commit is contained in:
Fredrik81 2020-02-24 00:33:01 +01:00
parent 09226fd5d5
commit 7eb62ed32e
6 changed files with 6 additions and 46 deletions

View File

@ -440,7 +440,6 @@ optional arguments:
--no-color Disable colorization of hyperopt results. May be --no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file. useful if you are redirecting output to a file.
--print-json Print best result detailization in JSON format. --print-json Print best result detailization in JSON format.
--print-table Print results in table format.
--no-details Do not print best epoch details. --no-details Do not print best epoch details.
Common arguments: Common arguments:

View File

@ -66,8 +66,7 @@ ARGS_HYPEROPT_LIST = ["hyperopt_list_best", "hyperopt_list_profitable",
"hyperopt_list_min_avg_time", "hyperopt_list_max_avg_time", "hyperopt_list_min_avg_time", "hyperopt_list_max_avg_time",
"hyperopt_list_min_avg_profit", "hyperopt_list_max_avg_profit", "hyperopt_list_min_avg_profit", "hyperopt_list_max_avg_profit",
"hyperopt_list_min_total_profit", "hyperopt_list_max_total_profit", "hyperopt_list_min_total_profit", "hyperopt_list_max_total_profit",
"print_colorized", "print_json", "print_table", "print_colorized", "print_json", "hyperopt_list_no_details"]
"hyperopt_list_no_details"]
ARGS_HYPEROPT_SHOW = ["hyperopt_list_best", "hyperopt_list_profitable", "hyperopt_show_index", ARGS_HYPEROPT_SHOW = ["hyperopt_list_best", "hyperopt_list_profitable", "hyperopt_show_index",
"print_json", "hyperopt_show_no_header"] "print_json", "hyperopt_show_no_header"]

View File

@ -220,12 +220,6 @@ AVAILABLE_CLI_OPTIONS = {
action='store_true', action='store_true',
default=False, default=False,
), ),
"print_table": Arg(
'--print-table',
help='Print results in table format.',
action='store_true',
default=False,
),
"hyperopt_jobs": Arg( "hyperopt_jobs": Arg(
'-j', '--job-workers', '-j', '--job-workers',
help='The number of concurrently running jobs for hyperoptimization ' help='The number of concurrently running jobs for hyperoptimization '

View File

@ -21,7 +21,6 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
print_colorized = config.get('print_colorized', False) print_colorized = config.get('print_colorized', False)
print_json = config.get('print_json', False) print_json = config.get('print_json', False)
print_table = config.get('print_table', False)
no_details = config.get('hyperopt_list_no_details', False) no_details = config.get('hyperopt_list_no_details', False)
no_header = False no_header = False
@ -47,26 +46,14 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
trials = _hyperopt_filter_trials(trials, filteroptions) trials = _hyperopt_filter_trials(trials, filteroptions)
# TODO: fetch the interval for epochs to print from the cli option
epoch_start, epoch_stop = 0, None
if print_colorized: if print_colorized:
colorama_init(autoreset=True) colorama_init(autoreset=True)
if print_table:
try: try:
Hyperopt.print_result_table(config, trials, total_epochs, Hyperopt.print_result_table(config, trials, total_epochs,
not filteroptions['only_best'], print_colorized) not filteroptions['only_best'], print_colorized)
except KeyboardInterrupt: except KeyboardInterrupt:
print('User interrupted..') print('User interrupted..')
else:
try:
# Human-friendly indexes used here (starting from 1)
for val in trials[epoch_start:epoch_stop]:
Hyperopt.print_results_explanation(val, total_epochs,
not filteroptions['only_best'], print_colorized)
except KeyboardInterrupt:
print('User interrupted..')
if trials and not no_details: if trials and not no_details:
sorted_trials = sorted(trials, key=itemgetter('loss')) sorted_trials = sorted(trials, key=itemgetter('loss'))

View File

@ -286,9 +286,6 @@ class Configuration:
self._args_to_config(config, argname='print_json', self._args_to_config(config, argname='print_json',
logstring='Parameter --print-json detected ...') logstring='Parameter --print-json detected ...')
self._args_to_config(config, argname='print_table',
logstring='Parameter --print-table detected: {}')
self._args_to_config(config, argname='hyperopt_jobs', self._args_to_config(config, argname='hyperopt_jobs',
logstring='Parameter -j/--job-workers detected: {}') logstring='Parameter -j/--job-workers detected: {}')

View File

@ -907,22 +907,6 @@ def test_hyperopt_list(mocker, capsys, hyperopt_results):
assert all(x not in captured.out assert all(x not in captured.out
for x in [" 1/12", " 3/12", " 4/12", " 5/12", " 7/12", " 8/12" for x in [" 1/12", " 3/12", " 4/12", " 5/12", " 7/12", " 8/12"
" 9/12", " 10/12", " 11/12", " 12/12"]) " 9/12", " 10/12", " 11/12", " 12/12"])
args = [
"hyperopt-list",
"--no-details",
"--print-table",
"--min-trades", "100",
"--print-json"
]
pargs = get_args(args)
pargs['config'] = None
start_hyperopt_list(pargs)
captured = capsys.readouterr()
assert all(x in captured.out
for x in [" 3/12", " 7/12", " 9/12", " 11/12"])
assert all(x not in captured.out
for x in [" 1/12", " 2/12", " 4/12", " 5/12", " 6/12", " 8/12", " 10/12"
" 12/12"])
def test_hyperopt_show(mocker, capsys, hyperopt_results): def test_hyperopt_show(mocker, capsys, hyperopt_results):