Skip to content

Commit

Permalink
update features
Browse files Browse the repository at this point in the history
  • Loading branch information
gxywy committed Mar 30, 2021
1 parent c4daa2c commit ee9ccb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions rl_plotter/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def colorize(string, color, bold=False, highlight=False):


class Logger():
def __init__(self, exp_name, log_dir="./logs", env_name=None):
self.log_dir = log_dir + "/" + exp_name + "/"
def __init__(self, log_dir="./logs", exp_name="exp", env_name=None, seed=0):
self.log_dir = log_dir = f"{log_dir}/{exp_name}_{env_name}-{seed}"
if not os.path.exists(self.log_dir):
os.makedirs(self.log_dir)
self.csv_file = open(self.log_dir + 'evaluator.csv', 'w', encoding='utf8')
Expand All @@ -47,6 +47,11 @@ def __init__(self, exp_name, log_dir="./logs", env_name=None):
self.logger.writeheader()
self.csv_file.flush()

def monitor_env(self, env):
from baselines import bench
env = bench.Monitor(env, self.log_dir, allow_early_resets=True)
return env

def update(self, score, total_steps):
'''
Score is a list
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="rl_plotter",
version="2.2.0",
version="2.2.1",
author="Gong Xiaoyu",
author_email="gxywy@hotmail.com",
description="A plotter for reinforcement learning (RL)",
Expand Down

0 comments on commit ee9ccb2

Please sign in to comment.