MCPcopy Create free account
hub / github.com/Howuhh/prioritized_experience_replay

github.com/Howuhh/prioritized_experience_replay @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
30 symbols 84 edges 5 files ⚖ MIT 0 documented · 0% updated 3y ago★ 901 open issues

Browse by type

Functions 26 Types & classes 4
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Prioritized Experience Replay

Simple and straightforward implementation with comments.

SumTree unlike other python implementations, is implemented without recursion, which is nearly twice faster (based on a couple of tests in ipython).
train.py also implements a simple DQN algorithm to validate PER.

Results

DQN with PER

10 seeds, not tuned hyperparameters, no beta schedule

To reproduce, run

python train.py --seeds 10 CartPole-v0

Sampling approaches

In the original publication, a particular method of prioritized sampling using SumTree is proposed, as follows:

To sample a minibatch of size k, the range [0, p_total] is divided equally into k ranges. Next, a value is uniformly sampled from each range. Finally the transitions that correspond to each of these sampled values are retrieved from the tree.

However, there is no justification in the publication as to why this sampling method was proposed. Samples with higher priority correspond to a larger interval in [0, p_total], so it should be enough to sample k values from range [0, p_total] uniformly, which is simpler to code.

As the graph below shows, there is no particular difference in the distribution of priorities among the two sampling methods.

To reproduce, run

python plots/sampling.py

References

Schaul, T., Quan, J., Antonoglou, I., & Silver, D. (2016). Prioritized Experience Replay. ArXiv:1511.05952 [Cs]. http://arxiv.org/abs/1511.05952

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 18
Function 8
Class 4

Languages

Python100%

Modules by API surface

train.py9 symbols
memory/buffer.py9 symbols
memory/tree.py7 symbols
plots/sampling.py3 symbols
memory/utils.py2 symbols

For agents

$ claude mcp add prioritized_experience_replay \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page