Added tests and updated doc
This commit is contained in:
parent
7606d814fa
commit
91db75a707
@ -450,6 +450,9 @@ optional arguments:
|
||||
useful if you are redirecting output to a file.
|
||||
--print-json Print best result detailization in JSON format.
|
||||
--no-details Do not print best epoch details.
|
||||
--export-csv FILE Export to CSV-File. Put + in front of filename to
|
||||
overwrite. This will disable table print. Example:
|
||||
--export-csv +hyperopt.csv
|
||||
|
||||
Common arguments:
|
||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||
|
@ -224,7 +224,8 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
"export_csv": Arg(
|
||||
'--export-csv',
|
||||
help='Export to CSV-File. Put + in front of filename to overwrite.'
|
||||
'Example: --export-csv +hyperopt.csv',
|
||||
' This will disable table print.'
|
||||
' Example: --export-csv +hyperopt.csv',
|
||||
metavar='FILE',
|
||||
),
|
||||
"hyperopt_jobs": Arg(
|
||||
|
@ -50,17 +50,18 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
|
||||
if print_colorized:
|
||||
colorama_init(autoreset=True)
|
||||
|
||||
try:
|
||||
Hyperopt.print_result_table(config, trials, total_epochs,
|
||||
not filteroptions['only_best'], print_colorized, 0)
|
||||
except KeyboardInterrupt:
|
||||
print('User interrupted..')
|
||||
if not export_csv:
|
||||
try:
|
||||
Hyperopt.print_result_table(config, trials, total_epochs,
|
||||
not filteroptions['only_best'], print_colorized, 0)
|
||||
except KeyboardInterrupt:
|
||||
print('User interrupted..')
|
||||
|
||||
if trials and not no_details:
|
||||
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] == '+':
|
||||
|
@ -902,7 +902,21 @@ def test_hyperopt_list(mocker, capsys, hyperopt_results):
|
||||
assert all(x not in captured.out
|
||||
for x in [" 1/12", " 3/12", " 4/12", " 5/12", " 7/12", " 8/12"
|
||||
" 9/12", " 10/12", " 11/12", " 12/12"])
|
||||
|
||||
args = [
|
||||
"hyperopt-list",
|
||||
"--no-details",
|
||||
"--export-csv", "+test_file.csv"
|
||||
]
|
||||
pargs = get_args(args)
|
||||
pargs['config'] = None
|
||||
start_hyperopt_list(pargs)
|
||||
captured = capsys.readouterr()
|
||||
assert all(x in captured.out
|
||||
for x in ["CSV-File created!"])
|
||||
f = Path("test_file.csv")
|
||||
assert 'Best,1,2,-1.25%,-0.00125625,,-2.51,"3,930.0 m",0.43662' in f.read_text()
|
||||
assert f.is_file()
|
||||
f.unlink()
|
||||
|
||||
def test_hyperopt_show(mocker, capsys, hyperopt_results):
|
||||
mocker.patch(
|
||||
|
Loading…
Reference in New Issue
Block a user