-
Notifications
You must be signed in to change notification settings - Fork 27
/
summarize_nip.py
executable file
·31 lines (24 loc) · 1.06 KB
/
summarize_nip.py
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
#!/usr/bin/env python3
import os
import sys
import argparse
from helpers.results_data import nip_stats
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Summarize results of NIP training')
parser.add_argument('dirs', nargs='*', default=['./data/models/nip'])
parser.add_argument('--stats', dest='stats', action='store_true', default=False,
help='Display summary stats')
parser.add_argument('--n', dest='n', action='store', default=1, type=int,
help='Set > 1 to average last N samples')
args = parser.parse_args()
for dirname in args.dirs:
if os.path.exists(dirname):
print('\n# {}'.format(dirname))
df = nip_stats(dirname, args.n)
print('\n', df.to_string())
if args.stats:
print('\nPer-pipeline summary:\n')
print(df.groupby('pipeline').mean().reset_index().to_string())
else:
print('Error: directory {} does not exist!'.format(os.path.abspath(dirname)))
sys.exit(1)