-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain_report.py
More file actions
31 lines (23 loc) · 802 Bytes
/
train_report.py
File metadata and controls
31 lines (23 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from statistics import mean, median,pstdev
import os.path
import os
import errno
import argparse
import sys
import json
import numpy as np
from datetime import datetime
parser = argparse.ArgumentParser(description='Train report build')
parser.add_argument('-a', '--history', help='History file name',default=None)
args = parser.parse_args()
def build_test_report(train_history):
report = {
"Mean" : mean(train_history["episode_reward"]),
"Median" : median(train_history["episode_reward"]),
"Standard deviation" : pstdev(train_history["episode_reward"])
}
with open(args.history[:-18] + '/train_report.json', 'w') as fp:
json.dump(report, fp)
with open(args.history, 'r') as fp:
train_history = json.load(fp)
build_test_report(train_history)