mirror of
https://github.com/wassname/DeepRL.git
synced 2026-10-29 12:40:58 +08:00
Update plot utility
This commit is contained in:
1 parent
2eefb04b9d
commit
8d19314360
2 files changed
+29
-17
No files matched your search
@@ -2,6 +2,8 @@
|
||||
|
||||
import numpy as np
|
||||
import component
|
||||
import os
|
||||
import re
|
||||
|
||||
class Plotter:
|
||||
COLORS = ['blue', 'green', 'red', 'cyan', 'magenta', 'yellow', 'black', 'purple', 'pink',
|
||||
@@ -61,3 +63,20 @@ class Plotter:
|
||||
plt.ylabel("Episode Rewards")
|
||||
if title is not None:
|
||||
plt.title(title)
|
||||
|
||||
def load_log_dirs(self, pattern, negative_pattern=' ', root='./log'):
|
||||
dirs = [item[0] for item in os.walk(root)]
|
||||
leaf_dirs = []
|
||||
for i in range(len(dirs)):
|
||||
if i + 1 < len(dirs) and dirs[i + 1].startswith(dirs[i]):
|
||||
continue
|
||||
leaf_dirs.append(dirs[i])
|
||||
names = []
|
||||
p = re.compile(pattern)
|
||||
np = re.compile(negative_pattern)
|
||||
for dir in leaf_dirs:
|
||||
if p.match(dir) and not np.match(dir):
|
||||
names.append(dir)
|
||||
print(dir)
|
||||
|
||||
return sorted(names)
|
||||
Reference in new issue
Block a user