From fb6e8fc1487aa24c8149ecdf9fed2c02edfdd84d Mon Sep 17 00:00:00 2001 From: LunmRE Date: Wed, 12 May 2021 11:12:07 +0800 Subject: [PATCH] fix evaluate bugs in ClassicalTrainer --- genrl/trainers/classical.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/genrl/trainers/classical.py b/genrl/trainers/classical.py index 2e75aeb2..b773b6e7 100644 --- a/genrl/trainers/classical.py +++ b/genrl/trainers/classical.py @@ -161,9 +161,11 @@ def evaluate(self, eval_ep: int = 100) -> float: ep_rew += reward if done: ep_rews.append(ep_rew) - ep += 1 mean_ep_rew = np.mean(ep_rews) - if ep == 100: + ep += 1 + state = self.env.reset() + ep_rew = 0 + if ep == eval_ep: print( "Evaluated for {} episodes, Mean Reward: {:.2f}, Std Deviation for the Reward: {:.2f}".format( eval_ep, mean_ep_rew, np.std(ep_rews)