Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save pythonlessons/e2a4f2aa8e46e27d65314071b94e65cb to your computer and use it in GitHub Desktop.
05_CartPole-reinforcement-learning_PER_D3QN
def batch_update(self, tree_idx, abs_errors):
abs_errors += self.PER_e # convert to abs and avoid 0
clipped_errors = np.minimum(abs_errors, self.absolute_error_upper)
ps = np.power(clipped_errors, self.PER_a)
for ti, p in zip(tree_idx, ps):
self.tree.update(ti, p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment