-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable1.py
26 lines (22 loc) · 1 KB
/
table1.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
import numpy as np
import os
_UCI_DIRECTORY_PATH = "DropoutUncertaintyExps-master/UCI_Datasets"
subfolders = [f.name for f in os.scandir(_UCI_DIRECTORY_PATH) if f.is_dir()]
subfolders.sort()
print('%-36s' % 'loglikelihood' + 'VFE ANN BioNN')
for j, f in enumerate(subfolders):
print('%29s' % f, end=' ')
try:
n_splits = int(np.loadtxt(_UCI_DIRECTORY_PATH + '/' + f + '/data/n_splits.txt'))
perfs = (-np.load('results/VFE/%s.npy' % f)[:, 1],
-np.load('results/ANN/%s.npy' % f)[:, 1],
-np.load('results/BioNN/%s.npy' % f)[:, 1])
means = np.mean(perfs, 1)
SEMs = np.std(perfs, 1) / np.sqrt(n_splits - 1)
best = np.isclose(means, means.max())
for i, (mean, SEM) in enumerate(zip(means, SEMs)):
print((('\x1b[1;32m' if best[i] else '') + '% .3f+-%.3f' % (mean, SEM) +
('\x1b[0m' if best[i] else '')).replace('nan', ' NA '), end=' ')
print()
except:
print('ERROR')