-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestpl.py
More file actions
42 lines (31 loc) · 1.33 KB
/
testpl.py
File metadata and controls
42 lines (31 loc) · 1.33 KB
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
from numpy import *
import math
import matplotlib.pyplot as plt
def read(fn):
f = open(fn,'r')
e = []
dev = []
test = []
for line in f:
if 'epoch: ' in line:
lines = line.strip().split(' / ')
e.append(int(lines[0].strip().replace('epoch: ','').strip()))
dev.append(float(lines[1].strip().replace('dev_acc: ','').strip()))
test.append(float(lines[2].strip().replace('test_acc: ','').strip()))
f.close()
return (e,test)
e, static = read('cnn-kim/result/static_eng')
plt.plot(e, static, 'b', label="Static") # plotting t, a separately
e, nonstatic = read('cnn-kim/result/nonstatic_eng')
plt.plot(e, nonstatic, 'r', label="Non static") # plotting t, a separately
e, rand = read('cnn-kim/result/rand_eng')
plt.plot(e, rand, 'y', label="Random") # plotting t, a separately
e, multichannel = read('cnn-kim/result/multichannel_eng')
plt.plot(e, multichannel, 'g', label="Multichannel") # plotting t, a separately
#plt.plot(e, dev, 'b', label="Development set") # plotting t, a separately
#plt.plot(e, test, 'r', label="Test set") # plotting t, b separately
plt.xlabel('Epoch')
plt.ylabel('Accuracy')
plt.legend(loc='upper center', bbox_to_anchor=(0.5, 0.5), fancybox=True, shadow=True, ncol=5)
plt.title('English static word embedding')
plt.show()