-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualize.py
More file actions
35 lines (26 loc) · 715 Bytes
/
Copy pathvisualize.py
File metadata and controls
35 lines (26 loc) · 715 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
34
35
import pandas as pd
import matplotlib.pyplot as plt
models = ["C51", "C51_2", "C51_3", "D3QN", "D3QN2", "D3QN3", "D3QN4", "D3QNPenalty", "FineTune"]
def plot(model_name):
df = pd.read_csv(f"model/{model_name}/logs/train.csv")
avg_reward = df["Avg R"]
avg_q = df["Avg Q"]
plt.figure(figsize=(10, 5))
# Left: Avg Reward
plt.subplot(1, 2, 1)
plt.plot(avg_reward)
plt.title("Average Reward")
plt.xlabel("Episodes")
plt.ylabel("Avg Reward")
# Right: Avg Q
plt.subplot(1, 2, 2)
plt.plot(avg_q)
plt.title("Average Q")
plt.xlabel("Episodes")
plt.ylabel("Avg Q")
plt.tight_layout()
plt.savefig(f"plots/metrics_plot_{model_name}.png")
plt.close()
#for model in models:
# plot(model)
plot("D3QN4")