-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults_eval_error.py
84 lines (69 loc) · 2.37 KB
/
results_eval_error.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python3
import argparse
import numpy as np
import matplotlib.pyplot as plt
import scipy
def set_axis_style(ax, labels):
ax.set_xticks(np.arange(1, len(labels) + 1), labels=labels, fontsize=20)
ax.set_xlim(0.25, len(labels) + 0.75)
def mean_confidence_interval(aa, confidence=0.95):
a = 1.0 * np.array(aa)
n = len(a)
# se = scipy.stats.sem(a)
#
# h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1)
# print(h, 1.96*aa.std(), 1.96 * (aa.std()/np.sqrt(n)))
h = 1.96 * (aa.std()/np.sqrt(n))
return h
def main():
print(args)
fig,ax =plt.subplots()
data = []
lbllls = ["1UNET\nrecfp\n2Blocks",
"1UNET\nrecfp\n3Blocks",
"1UNET\nrecfp\n4Blocks",
"2CNN\nrecfp/PVEloss\n4Blocks",
"2CNN\nrecfp/PVEloss\n6Blocks",
"2UNETS\nrecfp/PVEloss\n2Blocks",
"2UNETS\nrecfp/PVEloss\n3Blocks",
"2UNETS\nrecfp/PVEloss\n4Blocks",
"2UNETS\nrecfp\n2Blocks",
"2UNETS\nPVEloss\n2Blocks",
]
for k,inp in enumerate(args.inputs):
a = np.load(inp)
data.append(a)
# print(lbllls[k], a.mean(), a.std(), mean_confidence_interval(a))
print("---")
print(len(data))
ax.set_title("NRMSE")
ax.violinplot(data,showmeans=True)
set_axis_style(ax,labels=args.inputs)
fig,ax =plt.subplots()
data = []
# lbllls = args.inputs
for k,inp in enumerate(args.inputs):
inp = inp.replace("NRMSE", "NMAE")
a = np.load(inp)
data.append(a)
print(lbllls[k], a.mean(), a.std(), mean_confidence_interval(a))
print('---')
parts = ax.violinplot(data,showmeans=True)
ax.set_ylabel("NMAE", fontsize=20)
plt.yticks(fontsize=20)
set_axis_style(ax,labels=lbllls)
for partname in ('cbars', 'cmins', 'cmaxes', 'cmeans'):
vp = parts[partname]
vp.set_edgecolor("black")
vp.set_linewidth(2)
for pc in parts['bodies']:
pc.set_facecolor('#D43F3A')
pc.set_edgecolor('#D43F3A')
pc.set_alpha(1)
plt.rcParams["savefig.directory"] = "/export/home/tkaprelian/Desktop/PVE/Results/output_from_Jean_Zay/jnm_ablation/eval"
plt.show()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-i","--inputs", nargs="*")
args = parser.parse_args()
main()