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

gh-385: set random seeds in all glass functions used in notebooks #389

Merged
merged 10 commits into from
Nov 7, 2024

Conversation

paddyroddy
Copy link
Member

@paddyroddy paddyroddy commented Oct 30, 2024

Closes #385.

Leverage the rng input to all functions in glass so that the notebook figures should always be the same when run again.

Also add https://github.com/kynan/nbstripout with --keep-output which will clear the metadata of the notebooks but make sure figures are still shown.

Have tested this by running the notebooks in full and running pre-commit, and committing. Then executing in full again and running pre-commit and checking if anything changed - which it hadn't.

Leverage the `rng` input to all functions in `glass` so that the
notebook figures should always be the same when run again.
@paddyroddy paddyroddy added enhancement New feature or request science Science improvement or question labels Oct 30, 2024
@paddyroddy paddyroddy self-assigned this Oct 30, 2024
@paddyroddy paddyroddy marked this pull request as ready for review October 30, 2024 11:07
Copy link
Member

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, maintainability 📈

Thanks, @paddyroddy

@paddyroddy
Copy link
Member Author

@ntessore can you have a look?

Copy link
Collaborator

@ntessore ntessore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great effort to make the outputs more stable. There's one notebook that doesn't do any sampling, but still gets a rng.

In a separate change, we probably want to add a matplotlibrc or similar to control at least the resolution of the notebook figures – you can see here that the images still depend on who generated them.

examples/1-basic/shells.ipynb Show resolved Hide resolved
@paddyroddy paddyroddy merged commit b58c275 into main Nov 7, 2024
10 checks passed
@paddyroddy paddyroddy deleted the paddy/issue-385 branch November 7, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request science Science improvement or question
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set random seeds in the notebook outputs
3 participants