Skip to content
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

Shuffle samples to generate each mini-batch at Replay.get_batch. #59

Conversation

nagachika
Copy link
Contributor

Previous implementation randomize only the offset in the memory and the mini-batch contains a series of samples in original experienced order.
I believe the experiences should be sampled at random to get rid of bias of experiences.

I've realized np.random.permutation with whole memory capacity is not memory efficient. Because I'm newbee on Python and numpy, I cannot find the equivalent way to do this more efficiently. Any hint or suggestions are welcome.

Previous implementation randomize only the offset in the memory and
the mini-batch contains a series of samples in original experienced
order.
I believe the experiences should be sampled at random to get rid of
bias of experiences.
@michaelschaarschmidt
Copy link
Contributor

michaelschaarschmidt commented Jul 26, 2017

Hi,

thanks for helping! These are 2 separate strategies and both can be desired. One is to sample each entry separately (not with np.permutaton but with np.random.shuffle and re-assignment of keys or with just picking many indices), one is to sample continuous ranges. Hence, I wont merge this but rather suggest you create an issue and then we will see how we can make this optional.

Strategy 1: Batch size n, select n random indices
Strategy 2: Batch size n, select one index, continuous range, but reshuffle the data

1 sounds intuitively more performant to me but we will have a discussion

@nagachika
Copy link
Contributor Author

Thank you for your comment!
I didn't know that there's the case that the continuous experiences are desirable. I will file new issue to discuss optional strategies.

@nagachika nagachika deleted the shuffle_replay_memory_for_each_batch branch July 27, 2017 01:49
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.

None yet

2 participants