Skip to content
Snippets Groups Projects
Commit a09559e6 authored by Jörg Martin's avatar Jörg Martin
Browse files

Allowed for incomplete entries create_tabular

parent 02042a9a
No related branches found
No related tags found
No related merge requests found
import os
import glob
import argparse
import json
metrics_to_display = ['rmse','logdens','bias','coverage_normalized']
metrics_to_display = ['rmse','logdens','bias','true_coverage_numerical']
show_incomplete = True
list_of_result_files = glob.glob(os.path.join('results','*.json'))
results = {}
......@@ -12,6 +13,16 @@ for filename in list_of_result_files:
with open(filename,'r') as f:
results[data] = json.load(f)
def save_readout(dictionary, key):
"""
Returns the value of the `dictionary` for `key`, unless
the later doesn't exist, in which case (None,None) is returned.
"""
try:
return dictionary[key]
except KeyError:
return (None,None)
## header
header_string = 'DATA '
offset = 20
......@@ -21,19 +32,25 @@ print(header_string)
print(offset * '_' + 70 * '_')
## results
for data in results.keys():
noneiv_results = [results[data]['noneiv'][metric]
noneiv_results = [save_readout(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})'
if metric_mean is None:
noneiv_results_string += ' None (None)'
else:
noneiv_results_string += f' {metric_mean:.3f} ({metric_std:.3f})'
print(noneiv_results_string)
eiv_results = [results[data]['eiv'][metric]
eiv_results = [save_readout(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})'
if metric_mean is None:
eiv_results_string += ' None (None)'
else:
eiv_results_string += f' {metric_mean:.3f} ({metric_std:.3f})'
print(eiv_results_string)
print(offset * '_' + 70 * '_')
......
......@@ -19,7 +19,7 @@ from EIVTrainingRoutines import train_and_store, loss_functions
# read in data via --data option
parser = argparse.ArgumentParser()
parser.add_argument("--data", help="Loads data", default='california')
parser.add_argument("--data", help="Loads data", default='linear')
parser.add_argument("--no-autoindent", help="",
action="store_true") # to avoid conflics in IPython
args = parser.parse_args()
......
......@@ -19,7 +19,7 @@ from EIVTrainingRoutines import train_and_store, loss_functions
# read in data via --data option
parser = argparse.ArgumentParser()
parser.add_argument("--data", help="Loads data", default='california')
parser.add_argument("--data", help="Loads data", default='linear')
parser.add_argument("--no-autoindent", help="",
action="store_true") # to avoid conflics in IPython
args = parser.parse_args()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment