Initial work on csv-file export. Missing docs and tests

This commit is contained in:
Fredrik81
2020-03-05 01:58:33 +01:00
parent 57523d58df
commit 7606d814fa
5 changed files with 81 additions and 1 deletions

View File

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

View File

@@ -221,6 +221,12 @@ AVAILABLE_CLI_OPTIONS = {
action='store_true',
default=False,
),
"export_csv": Arg(
'--export-csv',
help='Export to CSV-File. Put + in front of filename to overwrite.'
'Example: --export-csv +hyperopt.csv',
metavar='FILE',
),
"hyperopt_jobs": Arg(
'-j', '--job-workers',
help='The number of concurrently running jobs for hyperoptimization '

View File

@@ -21,6 +21,7 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
print_colorized = config.get('print_colorized', False)
print_json = config.get('print_json', False)
export_csv = config.get('export_csv', None)
no_details = config.get('hyperopt_list_no_details', False)
no_header = False
@@ -59,6 +60,17 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
sorted_trials = sorted(trials, key=itemgetter('loss'))
results = sorted_trials[0]
Hyperopt.print_epoch_details(results, total_epochs, print_json, no_header)
print(export_csv)
if trials and export_csv:
overwrite_csv = False
if export_csv[0] == '+':
overwrite_csv = True
export_csv = export_csv[1:]
Hyperopt.export_csv_file(
config, trials, total_epochs,
not filteroptions['only_best'], export_csv, overwrite_csv
)
def start_hyperopt_show(args: Dict[str, Any]) -> None: