Show count of done episodes
@@ -60,6 +60,7 @@ if __name__ == "__main__":
total_rewards = []
step_idx = 0
+ done_episodes = 0
while True:
step_idx += 1
@@ -89,6 +90,7 @@ if __name__ == "__main__":
# handle new rewards
new_rewards = exp_source.pop_total_rewards()
if new_rewards:
+ done_episodes += 1
reward = new_rewards[0]
total_rewards.append(reward)
mean_rewards = float(np.mean(total_rewards[-100:]))
@@ -96,6 +98,7 @@ if __name__ == "__main__":
writer.add_scalar("reward", reward, step_idx)
writer.add_scalar("reward_100", mean_rewards, step_idx)
writer.add_scalar("epsilon", selector.epsilon, step_idx)
+ writer.add_scalar("episodes", done_episodes, step_idx)
if mean_rewards > 195:
print("Solved in %d steps!" % step_idx)
break
