-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotBoxplots.py
40 lines (27 loc) · 967 Bytes
/
plotBoxplots.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
import json
import numpy as np
import matplotlib.pyplot as plt
def read_everything(filesList):
to_do = None
for fname in filesList:
f = open(fname, "r")
data = json.load(f)
f.close()
if to_do is None:
to_do = data
else:
for i in range(len(data)):
to_do[i]["metric_tests"].extend(data[i]["metric_tests"])
return to_do
if __name__ == "__main__":
to_do = read_everything(["summary_plots_2_runs.json", "summary_plots_18_runs.json"])
n_experiments = len(to_do)
data = []
labels = ["a","b","c","d","e","f"]
to_do = [to_do[i] for i in [1,3,0,2,5,4]]
for id_experiment in range(n_experiments):
print(to_do[id_experiment]["classifier_name"], to_do[id_experiment]["feature"])
data.append(to_do[id_experiment]["metric_tests"])
plt.boxplot(data, labels = labels)
plt.savefig("boxplot.pdf",format="pdf")
plt.show()