-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccuracy_plots.py
More file actions
33 lines (30 loc) · 883 Bytes
/
accuracy_plots.py
File metadata and controls
33 lines (30 loc) · 883 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 subprocess
import os,sys
import matplotlib.pyplot as plt
max = 0
val_accuracy = []
filename= sys.argv[1]
# grep "INFO.*eval_accuracy =" triple_logs | awk -F "loss = " '{print $2}'
grep = subprocess.Popen(
["grep", "INFO.*eval_accuracy =" ,filename],
stdout=subprocess.PIPE,
)
awk = subprocess.Popen(
["awk" ,"-F" ,"eval_accuracy = ", "{print $2}"],
stdin=grep.stdout,
stdout=subprocess.PIPE,
)
awk2 = subprocess.Popen(
["awk" ,"-F" ,",", "{print $1}"],
stdin=awk.stdout,
stdout=subprocess.PIPE,
)
for line in awk2.stdout:
val_accuracy.append(float(line.decode('utf-8').replace('\n','')))
x = list(range(1, len(val_accuracy)+1))
plt.plot([100*i for i in x], val_accuracy, label="Validation", marker=".", color='g')
plt.xlabel('Steps sampled every 100 steps')
plt.ylabel('Accuracy')
plt.tight_layout()
plt.legend()
plt.savefig('figs/trip_val_accuracy.png')