Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update() retains discounted_reward from previous episodes #8

Closed
BigBadBurrow opened this issue Sep 20, 2019 · 2 comments
Closed

update() retains discounted_reward from previous episodes #8

BigBadBurrow opened this issue Sep 20, 2019 · 2 comments

Comments

@BigBadBurrow
Copy link

In the update() method the discounted_reward is always calculated using a gamma of the previous discounted_reward, but there's no break between episodes so the reward from one episode is carried across to the next, which I assume cannot be correct.

Suggest adding terminal_states list to the Memory class, and then setting the discounted_reward = 0 when a new episode starts.

nikhilbarhate99 added a commit that referenced this issue Sep 20, 2019
mentioned in issue #8
nikhilbarhate99 added a commit that referenced this issue Sep 20, 2019
mentioned in issue #8
@BigBadBurrow
Copy link
Author

Remember, the array is reversed so I think you'd need to set the discounted_reward = 0 first:

            if is_terminal:
                discounted_reward = 0
            discounted_reward = reward + (self.gamma * discounted_reward)
            rewards.insert(0, discounted_reward)

nikhilbarhate99 added a commit that referenced this issue Sep 20, 2019
@nikhilbarhate99
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants