Skip to content

Instantly share code, notes, and snippets.

@pythonlessons
Created January 15, 2020 08:17
Show Gist options
  • Select an option

  • Save pythonlessons/a3023d388ed9b1265631be420f1c1e0d to your computer and use it in GitHub Desktop.

Select an option

Save pythonlessons/a3023d388ed9b1265631be420f1c1e0d to your computer and use it in GitHub Desktop.
05_CartPole-reinforcement-learning_PER_D3QN
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