-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplot.py
executable file
·44 lines (32 loc) · 1.09 KB
/
plot.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
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
legends = ['train', 'val']
out_dir = "data/pasrl/"
# change the folder directories here!
# for holonomic weight
logs1 = pd.read_csv(out_dir + "progress.csv", error_bad_lines=False)
logs2 = pd.read_csv(out_dir + "val_progress.csv", error_bad_lines=False)
logDicts={1:logs1, 2:logs2}
graphDicts={0:'eprewmean', 1:'loss/value_loss', 2: 'loss/policy_loss', 3:'loss/PaS_loss'}
legendList=[]
# summarize history for accuracy
# for each metric
for i in range(len(graphDicts)):
plt.figure(i)
plt.title(graphDicts[i])
j = 0
for key in logDicts:
if graphDicts[i] not in logDicts[key]:
continue
else:
plt.plot(logDicts[key]['misc/total_timesteps'],logDicts[key][graphDicts[i]])
legendList.append(legends[j])
print('avg', str(key), graphDicts[i], np.average(logDicts[key][graphDicts[i]]))
j = j + 1
print('------------------------')
plt.xlabel('total_timesteps')
plt.legend(legendList, loc='lower right')
plt.savefig(out_dir + "training_curve"+str(i))
legendList=[]
plt.show()