Save json dictionaries
This commit is contained in:
parent
5e1f851f75
commit
a92480c431
|
@ -282,12 +282,12 @@ class Metrics(object):
|
|||
w))]
|
||||
|
||||
metrics_dictionary['episodes_fully_completed'][w][t] = \
|
||||
experiment_results_matrix[:, header.index('result')]
|
||||
experiment_results_matrix[:, header.index('result')].tolist()
|
||||
|
||||
metrics_dictionary['episodes_completion'][w][t] = \
|
||||
(experiment_results_matrix[:, header.index('initial_distance')]
|
||||
- experiment_results_matrix[:, header.index('final_distance')]) \
|
||||
/ experiment_results_matrix[:, header.index('initial_distance')]
|
||||
((experiment_results_matrix[:, header.index('initial_distance')]
|
||||
- experiment_results_matrix[:, header.index('final_distance')])
|
||||
/ experiment_results_matrix[:, header.index('initial_distance')]).tolist()
|
||||
|
||||
# Now we divide the experiment metrics matrix
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
def print_summary(metrics_summary, weathers, path):
|
||||
"""
|
||||
|
@ -14,15 +15,10 @@ def print_summary(metrics_summary, weathers, path):
|
|||
6: 'Heavy Rain Noon', 8: 'Clear Sunset',
|
||||
4: 'Cloudy After Rain', 14: 'Soft Rain Sunset'}
|
||||
|
||||
|
||||
# First we write the entire dictionary on the benchmark folder.
|
||||
fout = os.path.join(path, 'metrics.txt')
|
||||
fo = open(fout, "w")
|
||||
with open(os.path.join(path, 'metrics.json'), 'w') as fo:
|
||||
fo.write(json.dumps(metrics_summary, fo))
|
||||
|
||||
for k, v in metrics_summary.items():
|
||||
fo.write(str(k) + ' >>> ' + str(v) + '\n\n')
|
||||
|
||||
fo.close()
|
||||
# Second we plot the metrics that are already ready by averaging
|
||||
|
||||
metrics_to_average = [
|
||||
|
|
Loading…
Reference in New Issue