ledmands
commited on
Commit
•
449b9e9
1
Parent(s):
e036817
started using numpy like i should have to begin with...
Browse files- plot_evaluations.py +10 -2
plot_evaluations.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
from numpy import load
|
|
|
2 |
import matplotlib.pyplot as plt
|
3 |
# import matplotlib.axes
|
4 |
|
5 |
-
filepath = "dqn_v2-
|
6 |
|
7 |
data = load(filepath)
|
8 |
lst = data.files # data.files lists the keys that are available for data
|
@@ -11,7 +12,13 @@ lst = data.files # data.files lists the keys that are available for data
|
|
11 |
|
12 |
# results and ep_lengths are 2d arrays, because each evaluation is 5 episodes long.
|
13 |
# I want to plot the average of each evaluation.
|
|
|
|
|
|
|
|
|
|
|
14 |
|
|
|
15 |
# for each item in results, loop through the array and save the average
|
16 |
avg_ep_result_arr = []
|
17 |
for eval in data['results']:
|
@@ -49,4 +56,5 @@ plt.ylim(top=y_limit)
|
|
49 |
# lineObjects = plt.plot(x, y)
|
50 |
plt.legend(["avg ep result", "avg ep length"])
|
51 |
plt.title("result and length over steps\nfilepath: " + filepath)
|
52 |
-
plt.show()
|
|
|
|
1 |
from numpy import load
|
2 |
+
import numpy as np
|
3 |
import matplotlib.pyplot as plt
|
4 |
# import matplotlib.axes
|
5 |
|
6 |
+
filepath = "agents/dqn_v2-7/evaluations.npz"
|
7 |
|
8 |
data = load(filepath)
|
9 |
lst = data.files # data.files lists the keys that are available for data
|
|
|
12 |
|
13 |
# results and ep_lengths are 2d arrays, because each evaluation is 5 episodes long.
|
14 |
# I want to plot the average of each evaluation.
|
15 |
+
print(data["results"])
|
16 |
+
print()
|
17 |
+
print(np.delete(np.sort(data["results"]), 0, 1))
|
18 |
+
# for i in range(len(data["results"])):
|
19 |
+
# print(np.average(data["results"][i]))
|
20 |
|
21 |
+
'''
|
22 |
# for each item in results, loop through the array and save the average
|
23 |
avg_ep_result_arr = []
|
24 |
for eval in data['results']:
|
|
|
56 |
# lineObjects = plt.plot(x, y)
|
57 |
plt.legend(["avg ep result", "avg ep length"])
|
58 |
plt.title("result and length over steps\nfilepath: " + filepath)
|
59 |
+
plt.show()
|
60 |
+
'''
|