-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdrawCER.py
More file actions
33 lines (25 loc) · 826 Bytes
/
drawCER.py
File metadata and controls
33 lines (25 loc) · 826 Bytes
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
import matplotlib.pyplot as plt
base = 'pred_logs/'
cer = open(base+'cer_train.log', 'r')
cer_data = cer.read().split(' ')[:-1]
cerr = [float(i) for i in cer_data]
cer2 = open(base+'cer_train2.log', 'r')
cer_data2 = cer2.read().split(' ')[:-1]
cerr2 = [float(i) for i in cer_data2]
cer_t = open(base+'cer_test.log', 'r')
cer_data_t = cer_t.read().split(' ')[:-1]
cerr_t = [float(i) for i in cer_data_t]
plt.plot(cerr, 'r-')
cer_spot, = plt.plot(cerr, 'ro')
plt.plot(cerr2, 'c-')
cer_spot2, = plt.plot(cerr2, 'co')
plt.plot(cerr_t, 'b-')
cer_spot_t, = plt.plot(cerr_t, 'bo')
plt.legend([cer_spot, cer_spot2, cer_spot_t], ['CER train with true label', 'CER train with predicted label', 'CER test'])
plt.xlabel('epoch')
plt.ylim(0, 1.1)
plt.title('character error rate')
plt.show()
cer.close()
cer2.close()
cer_t.close()