-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_results.py
34 lines (29 loc) · 880 Bytes
/
view_results.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
import numpy as np
with open("results.txt", "r") as f:
fileinfo = f.read().split('\n')
data=[]
for line in fileinfo:
post = []
data_line = line.split(',')
for data_post in data_line:
number = float(data_post)
post.append(number)
data.append(post)
data = np.array(data)
epochs = np.array(list(range(len(data))))
print(data.shape)
import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(ncols=2)
ax1.plot(epochs, data[:,0], label="Training loss")
ax1.plot(epochs, data[:,2], label="Validation loss")
ax2.plot(epochs, data[:,1], label="Training accuracy")
ax2.plot(epochs, data[:,3], label="Validation accuracy")
ax1.set_xlabel("Epochs")
ax2.set_xlabel("Epochs")
ax1.set_ylabel("Loss")
ax2.set_ylabel("Accuracy")
ax1.legend()
ax2.legend()
ax1.title.set_text("Loss")
ax2.title.set_text("Accuracy")
plt.show()