-
Notifications
You must be signed in to change notification settings - Fork 0
/
E2_real_plot.py
51 lines (36 loc) · 1.22 KB
/
E2_real_plot.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
"""
Classification of synthetic -- plot
"""
import numpy as np
import os
import matplotlib.pyplot as plt
dataset_names = os.listdir('datasets')
try:
dataset_names.remove('.DS_Store')
except:
pass
method_names = ['KNN', 'GNB', 'SVM', 'MLP', 'DPL-none', 'DPL-sqrt', 'DPL-log', 'DPL-std']
cols = ['b','b','b','b','r','r','r','r']
markers = ['o','x','*','s','o','x','*','s']
res = np.load('results/E2_real.npy')
print(res.shape) # datasets x folds x methods
res = np.mean(res, axis=1)
dataset_names = [d.split('.')[0] for d in dataset_names]
order = np.argsort(dataset_names)
res = res[order]
dataset_names = np.array(dataset_names)[order]
fig, ax = plt.subplots(1,1,figsize=(13,5))
for method_id, method in enumerate(method_names):
ax.scatter(np.arange(len(dataset_names)), res[:, method_id], marker=markers[method_id], c=cols[method_id], label=method)
ax.set_xticks(np.arange(len(dataset_names)), dataset_names, rotation=90)
ax.set_xlim(-1,68)
ax.set_ylim(0.3, 1.01)
ax.set_ylabel('BAC')
ax.grid(ls=':')
ax.legend(frameon=False)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
plt.tight_layout()
plt.savefig('figures/E2_real.png')
plt.savefig('foo.png')
plt.savefig('figures/E2_real.eps')