Last active
January 15, 2020 06:44
-
-
Save pythonlessons/660d4e675cf5745afbb1e6343f93349c 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 update(self, tree_index, priority): | |
| # Change = new priority score - former priority score | |
| change = priority - self.tree[tree_index] | |
| self.tree[tree_index] = priority | |
| # then propagate the change through tree | |
| # this method is faster than the recursive loop | |
| while tree_index != 0: | |
| tree_index = (tree_index - 1) // 2 | |
| self.tree[tree_index] += change |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment