-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDraw.py
47 lines (47 loc) · 2.18 KB
/
Draw.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
import numpy as np
import matplotlib.pyplot as plt
class Draw:
def __init__(self):
self.loss1 = np.load('data/loss0.01residuals.npy') / (2708-140)
self.loss2 = np.load('data/loss0.05residuals.npy') / (2708-140)
self.loss5 = np.load('data/loss0.1residuals.npy') / (2708-140)
self.loss10 = np.load('data/loss0.2residuals.npy') / (2708-140)
self.loss14 = np.load('data/loss无邻接矩阵residuals.npy') / (2708 - 140)
self.test_acc1 = np.load('data/test_acc_0.01residuals.npy') / (2708-140)
self.test_acc2 = np.load('data/test_acc_0.05residuals.npy') / (2708-140)
self.test_acc5 = np.load('data/test_acc_0.1residuals.npy') / (2708-140)
self.test_acc10 = np.load('data/test_acc_0.2residuals.npy') / (2708-140)
self.test_acc14 = np.load('data/test_acc_无邻接矩阵residuals.npy') / (2708 - 140)
def draw_loss(self):
epochs = np.linspace(1,len(self.loss1),len(self.loss1))
plt.plot(epochs,self.loss1,label=r'$e_\Delta$=0.01')
plt.plot(epochs, self.loss2,label=r'$e_\Delta$=0.05')
plt.plot(epochs, self.loss5,label=r'$e_\Delta$=0.1')
plt.plot(epochs, self.loss10,label=r'$e_\Delta$=0.2')
plt.plot(epochs, self.loss14, label=r'without $\hat{A}$')
plt.xticks(fontsize=16)
plt.yticks(fontsize=16)
plt.legend(fontsize=16)
plt.grid()
plt.show()
def draw_test_acc(self):
epochs = np.linspace(1, len(self.test_acc1), len(self.test_acc1))
plt.plot(epochs, self.test_acc1, label=r'$e_\Delta$=0.01')
plt.plot(epochs, self.test_acc2, label=r'$e_\Delta$=0.05')
plt.plot(epochs, self.test_acc5, label=r'$e_\Delta$=0.1')
plt.plot(epochs, self.test_acc10, label=r'$e_\Delta$=0.2')
plt.plot(epochs, self.test_acc14, label=r'without $\hat{A}$')
plt.xticks(fontsize=16)
plt.yticks(fontsize=16)
plt.legend(fontsize=16)
plt.grid()
plt.show()
if __name__ == "__main__":
Draw = Draw()
Draw.draw_loss()
# Draw.draw_test_acc()
print(Draw.test_acc1[-1])
print(Draw.test_acc2[-1])
print(Draw.test_acc5[-1])
print(Draw.test_acc10[-1])
print(Draw.test_acc14[-1])