-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Reproducible jitter #1996
Merged
Merged
Reproducible jitter #1996
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
35f8eb0
position_jitter() gains seed argument
krlmlr 9c9951e
use only one with_seed() call
krlmlr b789ed3
use mode = 'integer'
krlmlr 5bfcb59
actually set seed
krlmlr f227475
fixed seed by default
krlmlr d612276
NEWS
krlmlr b988c0a
support seed = NA, which is now the default
krlmlr 6f20e6c
with_seed() always initializes RNG
krlmlr a00407e
added example
krlmlr f0d3e1a
extract function
krlmlr ae4f33c
fix and clarify example
krlmlr 28b114b
NA picks a random seed using sample.int()
krlmlr f222cfc
extract with_preserve_seed()
krlmlr 7715aa7
extract function
krlmlr 7774c65
use withr
krlmlr e581b98
Merge remote-tracking branch 'origin/master' into f-reproducible-jitter
krlmlr cf0df38
Merge remote-tracking branch 'origin/master' into f-reproducible-jitter
krlmlr d0bf701
move entry to NEWS.md
krlmlr bc38d73
add withr as remote
krlmlr 5e4ff40
Merge branch 'master' into f-reproducible-jitter
karawoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this definitely ok to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yihui: knitr seems to cache/restore .Random.seed, too. The caching in knitr is explicit, but it looks like the restore happens implicitly. Could you please comment if my way of restoring the random seed is safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is safe (I'd add
mode = 'integer'
toget0()
, though), but it seems that you forgot toset.seed(seed)
beforecode
is evaluated?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. The code worked by accident because resetting the random seed after applying the jitter also made it reproducible.