Skip to content

Fix priority sampling #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 14, 2023
Merged

Fix priority sampling #57

merged 3 commits into from
Sep 14, 2023

Conversation

HenriDeh
Copy link
Member

This PR fixes the issue of the unlikely but not impossible sampling of invalid steps with prioritized replay buffers.
Instead of relying on the internal sum_tree, I moved to the FrequencyWeights of StatsBase. SumTree is still used to maintain and update the priorities, but for sampling it was much simpler to use StatsBase (also this is a mature package in the Julian ecosystem).

As far as I know, Frequency Sampling weights the elements identically to the current sumtree sampling. I do not know about the efficiency but I did not observe a slow down in the experiments.

This PR relies on #56 so it must be merged afterward.

@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #57 (ae42284) into main (c89ed6f) will increase coverage by 0.96%.
The diff coverage is 97.91%.

@@            Coverage Diff             @@
##             main      #57      +/-   ##
==========================================
+ Coverage   73.54%   74.50%   +0.96%     
==========================================
  Files          15       15              
  Lines         756      765       +9     
==========================================
+ Hits          556      570      +14     
+ Misses        200      195       -5     
Files Changed Coverage Δ
src/traces.jl 79.44% <0.00%> (-0.45%) ⬇️
src/common/sum_tree.jl 81.60% <100.00%> (ø)
src/samplers.jl 84.54% <100.00%> (+5.13%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@HenriDeh HenriDeh merged commit e55919c into main Sep 14, 2023
@HenriDeh HenriDeh deleted the fix-prio branch September 14, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants