-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscript_evaluation_plots.py
72 lines (53 loc) · 2.46 KB
/
script_evaluation_plots.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
import numpy as np
import matplotlib.pyplot as plt
from code.ResultSaving import ResultSaving
#---------- clustering results evaluation -----------------
#---- IMDBBINARY, IMDBMULTI, MUTAG, NCI1, PTC, PROTEINS, COLLAB, REDDITBINARY, REDDITMULTI5K ----
#---- isolated_segment, padding_pruning, full_input
strategy = 'isolated_segment'
dataset_name = 'IMDBMULTI'
residual_type = 'none'
if 1:
epoch_number = 500
result_obj = ResultSaving('', '')
result_obj.result_destination_folder_path = './result/AuGBert/' + strategy + '/' + dataset_name + '/'
result_list = []
time_list = []
for fold in range(1, 11):
result_obj.result_destination_file_name = dataset_name + '_' + str(fold) + '_' + str(epoch_number) + '_' + residual_type + '_' + strategy
loaded_result = result_obj.load()
time_list.append(sum([loaded_result[epoch]['time'] for epoch in loaded_result]))
result_list.append(np.max([loaded_result[epoch]['acc_test'] for epoch in loaded_result]))
print('accuracy: {:.2f}$\pm${:.2f}'.format(100*np.mean(result_list), 100*np.std(result_list)))
print('time: {:.2f}$\pm${:.2f}'.format(np.mean(time_list), np.std(time_list)))
dataset_name = 'PROTEINS'
strategy = 'padding_pruning'
if 0:
epoch_number = 500
residual_type = 'raw'
fold_list = range(1, 11)
result_obj = ResultSaving('', '')
result_obj.result_destination_folder_path = './result/AuGBert/' + strategy + '/' + dataset_name + '/'
fold_result_dict = {}
for fold in fold_list:
result_obj.result_destination_file_name = dataset_name + '_' + str(fold) + '_' + str(epoch_number) + '_' + residual_type
fold_result_dict[fold] = result_obj.load()
x = range(epoch_number)
plt.figure(figsize=(4, 3))
for fold in fold_list:
train_acc = [fold_result_dict[fold][i]['acc_train'] for i in x]
plt.plot(x, train_acc, label=str(fold) + '-fold)')
plt.xlim(0, epoch_number)
plt.ylabel("training accuracy %")
plt.xlabel("epoch (iter. over training set)")
plt.legend(loc="lower right", fontsize='small', ncol=2,)
plt.show()
plt.figure(figsize=(4, 3))
for fold in fold_list:
train_acc = [fold_result_dict[fold][i]['acc_test'] for i in x]
plt.plot(x, train_acc, label=str(fold) + '-fold)')
plt.xlim(0, epoch_number)
plt.ylabel("testing accuracy %")
plt.xlabel("epoch (iter. over training set)")
plt.legend(loc="lower right", fontsize='small', ncol=2,)
plt.show()