-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGraphs.py
More file actions
41 lines (38 loc) · 1.79 KB
/
Graphs.py
File metadata and controls
41 lines (38 loc) · 1.79 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
import numpy as np
import matplotlib.pyplot as plt
import os
if __name__ == '__main__':
for filename in sorted(os.listdir('../data/results/')):
labels = filename[:-4].split('_')
data = np.loadtxt('../data/results/' + filename)
avg_ = data[:,1]
min_ = data[:,2]
max_ = data[:,3]
plt.plot(min_, color='#e6e6e6')
plt.plot(max_, color='#e6e6e6')
plt.fill_between(list(range(len(avg_))), min_,max_,interpolate=True,color='#e6e6e6')
plt.plot(avg_, color='blue')
if filename == 'distilled_HDQNModel_all-skills.csv':
plt.title('Distilled h-DQN on Composite Scenario', fontsize=16)
else:
plt.title('Training Reward, Algo: ' + labels[0] + ', Model: ' + labels[1] + ', Config: ' + labels[2], fontsize=10)
plt.ylabel('Average Reward Per Epoch')
plt.xlabel('Training Epochs')
plt.savefig("../doc/figures/" + filename[:-4] + "_training_results.png")
plt.figure()
data_0 = np.loadtxt('../data/results/double-dqlearn_DQNModel_all-skills.csv')
data_1 = np.loadtxt('../data/results/double-dqlearn_HDQNModel_all-skills.csv')
avg_ = data_1[:,1]
min_ = data_1[:,2]
max_ = data_1[:,3]
plt.plot(min_, color='#e6e6e6')
plt.plot(max_, color='#e6e6e6')
plt.fill_between(list(range(len(avg_))), min_,max_,interpolate=True,color='#e6e6e6')
line1, = plt.plot(avg_, color='blue', label='h-DQN')
line2, = plt.plot(data_0[:,1], color='red', label='DQN')
plt.legend(handles=[line1, line2], loc='center left', bbox_to_anchor=(0.775, 0.2))
plt.title('h-DQN vs DQN on Composite Scenario', fontsize=16)
plt.ylabel('Average Reward Per Epoch')
plt.xlabel('Training Epochs')
plt.savefig("../doc/figures/all_skills_HDQNvsDQN_training_results.png")
plt.figure()