Refactor random number generation to use self.np_random for seeding environments correctly - #43
Open
StefanHamm wants to merge 2 commits into
Open
Refactor random number generation to use self.np_random for seeding environments correctly#43StefanHamm wants to merge 2 commits into
StefanHamm wants to merge 2 commits into
Conversation
…istency across environments
Author
|
Short script to test the seeding |
Author
|
fixes #42 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement Deterministic Seeding via self.np_random
Description
This PR standardizes the random number generation across all environments to ensure full reproducibility. All instances of randomness (including internal function calls) have been updated to use the Gymnasium standard
self.np_randomgenerator.This allows users to seed the environment initialization and the resulting episode sequence using
env.reset(seed=...).Key Changes
self.np_randominstead ofnumpy.randomor standardrandomlibrary calls.env.reset(seed=X)once after env creation, guarantees that the specific episode and the subsequent sequence of episodes are deterministic initizialized.env.reset()(without a seed) maintains standard stochastic behavior for diverse training data.