-
Notifications
You must be signed in to change notification settings - Fork 1
/
figure.py
107 lines (87 loc) · 3.4 KB
/
figure.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import xlrd
import matplotlib.pyplot as plt
ExcelFile = xlrd.open_workbook('/home/cvnlp/test_100.xlsx')
ExcelFile1 = xlrd.open_workbook('/home/cvnlp/test_100_limit.xlsx')
# sheet = ExcelFile.sheet_by_name('epoch_trainloss')
# epoch_trainloss = sheet.col_values(0)
# sheet = ExcelFile.sheet_by_name('epoch_testloss')
# epoch_testloss = sheet.col_values(0)
#
#
# plt.xlabel("Training Epochs")
# plt.ylabel("Training Loss")
# plt.plot(range(1,len(epoch_trainloss)+1),epoch_trainloss,lw=2,label="epoch_trainloss")
# # plt.plot(range(1,len(epoch_testloss)+1),epoch_testloss,lw=2,label="epoch_testloss")
#
# plt.ylim((0,0.9))
# plt.xlim((0,len(epoch_trainloss)))
# plt.legend()
# plt.show()
# sheet = ExcelFile.sheet_by_name('epoch_trainacc')
# epoch_trainacc = sheet.col_values(0)
# sheet = ExcelFile.sheet_by_name('epoch_testacc')
# epoch_testacc = sheet.col_values(0)
#
# epoch_trainacc = list(map(lambda x:x*100, epoch_trainacc))
# epoch_testacc = list(map(lambda x:x*100, epoch_testacc))
# plt.xlabel("Training Epochs")
# plt.ylabel("Accuracy")
# plt.plot(range(1,len(epoch_trainacc)+1),epoch_trainacc,lw=2,label="epoch_trainacc")
# plt.plot(range(1,len(epoch_testacc)+1),epoch_testacc,lw=2,label="epoch_testacc")
#
# plt.ylim((50,100))
# plt.xlim((0,len(epoch_trainacc)))
# plt.legend()
# plt.show()
sheet = ExcelFile.sheet_by_name('epoch_trainloss')
epoch_trainloss = sheet.col_values(0)
sheet = ExcelFile1.sheet_by_name('epoch_trainloss')
epoch_testloss = sheet.col_values(0)
plt.xlabel("Training Epochs")
plt.ylabel("Training Loss")
plt.plot(range(1,len(epoch_trainloss)+1),epoch_trainloss,lw=2,label="epoch_trainloss")
plt.plot(range(1,len(epoch_testloss)+1),epoch_testloss,lw=2,label="epoch_trainloss_limit")
plt.ylim((0,0.9))
plt.xlim((0,len(epoch_trainloss)))
plt.legend()
plt.show()
sheet = ExcelFile.sheet_by_name('epoch_trainacc')
epoch_trainacc = sheet.col_values(0)
sheet = ExcelFile1.sheet_by_name('epoch_trainacc')
epoch_testacc = sheet.col_values(0)
epoch_trainacc = list(map(lambda x:x*100, epoch_trainacc))
epoch_testacc = list(map(lambda x:x*100, epoch_testacc))
plt.xlabel("Training Epochs")
plt.ylabel("Accuracy")
plt.plot(range(1,len(epoch_trainacc)+1),epoch_trainacc,lw=2,label="epoch_trainacc")
plt.plot(range(1,len(epoch_testacc)+1),epoch_testacc,lw=2,label="epoch_trainacc_limit")
plt.ylim((50,100))
plt.xlim((0,len(epoch_trainacc)))
plt.legend()
plt.show()
sheet = ExcelFile.sheet_by_name('epoch_testloss')
epoch_trainloss = sheet.col_values(0)
sheet = ExcelFile1.sheet_by_name('epoch_testloss')
epoch_testloss = sheet.col_values(0)
plt.xlabel("Training Epochs")
plt.ylabel("Training Loss")
plt.plot(range(1,len(epoch_trainloss)+1),epoch_trainloss,lw=2,label="epoch_testloss")
plt.plot(range(1,len(epoch_testloss)+1),epoch_testloss,lw=2,label="epoch_testloss_limit")
plt.ylim((0,0.9))
plt.xlim((0,len(epoch_trainloss)))
plt.legend()
plt.show()
sheet = ExcelFile.sheet_by_name('epoch_testacc')
epoch_trainacc = sheet.col_values(0)
sheet = ExcelFile1.sheet_by_name('epoch_testacc')
epoch_testacc = sheet.col_values(0)
epoch_trainacc = list(map(lambda x:x*100, epoch_trainacc))
epoch_testacc = list(map(lambda x:x*100, epoch_testacc))
plt.xlabel("Training Epochs")
plt.ylabel("Accuracy")
plt.plot(range(1,len(epoch_trainacc)+1),epoch_trainacc,lw=2,label="epoch_testacc")
plt.plot(range(1,len(epoch_testacc)+1),epoch_testacc,lw=2,label="epoch_testacc_limit")
plt.ylim((50,100))
plt.xlim((0,len(epoch_trainacc)))
plt.legend()
plt.show()