Created
January 15, 2020 08:17
-
-
Save pythonlessons/a3023d388ed9b1265631be420f1c1e0d to your computer and use it in GitHub Desktop.
05_CartPole-reinforcement-learning_PER_D3QN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def store(self, experience): | |
| # Find the max priority | |
| max_priority = np.max(self.tree.tree[-self.tree.capacity:]) | |
| # If the max priority = 0 we can't put priority = 0 since this experience will never have a chance to be selected | |
| # So we use a minimum priority | |
| if max_priority == 0: | |
| max_priority = self.absolute_error_upper | |
| self.tree.add(max_priority, experience) # set the max priority for new priority |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment