-
Jörg Martin authoredJörg Martin authored
create_tabular.py 1.36 KiB
import os
import glob
import json
metrics_to_display = ['rmse','logdens','bias','coverage_normalized']
list_of_result_files = glob.glob(os.path.join('results','*.json'))
results = {}
for filename in list_of_result_files:
data = filename.replace(os.path.join('results','metrics_'),'').replace('.json','')
with open(filename,'r') as f:
results[data] = json.load(f)
## header
header_string = 'DATA '
offset = 20
for metric in metrics_to_display:
header_string += f' {metric} '
print(header_string)
print(offset * '_' + 70 * '_')
## results
for data in results.keys():
noneiv_results = [results[data]['noneiv'][metric]
for metric in metrics_to_display]
noneiv_row_name = f'{data} - nonEiV:'
noneiv_results_string = noneiv_row_name + (offset - len(noneiv_row_name)) * ' '
for [metric_mean, metric_std] in noneiv_results:
noneiv_results_string += f' {metric_mean:.3f} ({metric_std:.3f})'
print(noneiv_results_string)
eiv_results = [results[data]['eiv'][metric]
for metric in metrics_to_display]
eiv_row_name = f'{data} - EiV:'
eiv_results_string = eiv_row_name + (offset - len(eiv_row_name)) * ' '
for [metric_mean, metric_std] in eiv_results:
eiv_results_string += f' {metric_mean:.3f} ({metric_std:.3f})'
print(eiv_results_string)
print(offset * '_' + 70 * '_')