-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot.py
57 lines (40 loc) · 1.69 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
45
46
47
48
49
50
51
52
53
54
55
# to plot results
import matplotlib.pyplot as plt
import pandas as pd
def plot_trained():
df_trained = pd.read_csv('trained_data.csv')
plt.plot(df_trained['episode'],df_trained['waiting_time'],'b-',label="Trained")
plt.xlabel('episode')
plt.ylabel('waiting time (s)')
plt.show()
def plot_untrained():
df_untrained = pd.read_csv('untrained_data.csv')
plt.plot(df_untrained['episode'],df_untrained['waiting_time'],'r-',label="Untrained")
plt.xlabel('episode')
plt.ylabel('waiting time (s)')
plt.show()
# plot_untrained()
def plot_trained_vs_untrained_reward():
df_trained = pd.read_csv('trained_data.csv')
df_untrained = pd.read_csv('untrained_data.csv')
plt.plot(df_trained['episode'],-df_trained['reward'],'b-',label="Trained")
plt.plot(df_untrained['episode'],-df_untrained['reward'],'r-',label="Untrained")
plt.xlabel('episode')
plt.ylabel('reward')
plt.show()
avg_reward_T = -sum(df_trained['reward'])
avg_reward_U = -sum(df_untrained['reward'])
print("reward T",avg_reward_T," avg_reward_U ",avg_reward_U, "difference ",avg_reward_T-avg_reward_U)
plot_trained_vs_untrained_reward()
def plot_trained_vs_untrained_wt():
df_trained = pd.read_csv('trained_data.csv')
df_untrained = pd.read_csv('untrained_data.csv')
plt.plot(df_trained['episode'],df_trained['waiting_time'],'b-',label="Trained")
plt.plot(df_untrained['episode'],df_untrained['waiting_time'],'r-',label="Untrained")
plt.xlabel('episode')
plt.ylabel('waiting time(s)')
plt.show()
# total_time_trained = sum(df_trained['waiting_time'])
# total_time_untrained = sum(df_untrained['waiting_time'])
# print(total_time_untrained,total_time_trained,total_time_untrained- total_time_trained)
# time : 1016174 866401 149773