From 14c04eff879131ae439d30ca064ee4169fff073f Mon Sep 17 00:00:00 2001 From: Shangtong Zhang Date: Wed, 30 May 2018 11:37:13 -0600 Subject: [PATCH] Update plotter --- deep_rl/utils/plot.py | 13 +++++++++++++ examples.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/deep_rl/utils/plot.py b/deep_rl/utils/plot.py index 690c0c0..13ea7b5 100644 --- a/deep_rl/utils/plot.py +++ b/deep_rl/utils/plot.py @@ -52,6 +52,19 @@ class Plotter: xy_list = [self.window_func(x, y, episode_window, np.mean) for x, y in xy_list] return xy_list + def load_evaluation_episodes_results(self, + dirs, + evaluation_episodes_interval, + evaluation_episodes, + max_timesteps=1e8): + raw_data = self.load_results(dirs, max_timesteps, episode_window=0) + ys = [] + for x, y in raw_data: + y = np.reshape(np.asarray(y), (-1, evaluation_episodes)).mean(-1) + x = np.arange(y.shape[0]) * evaluation_episodes_interval + ys.append(y) + return x, np.stack(ys) + def average(self, xy_list, bin, max_timesteps, top_k=0): if top_k: perf = [np.max(y) for _, y in xy_list] diff --git a/examples.py b/examples.py index 85aacdb..6628964 100644 --- a/examples.py +++ b/examples.py @@ -438,7 +438,7 @@ if __name__ == '__main__': # ddpg_low_dim_state() # ddpg_pixel() - ppo_continuous() + # ppo_continuous() # action_conditional_video_prediction()