Skip to content

TST Use global_random_seed in sklearn/datasets/tests/test_samples_generator.py #31181

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 5 commits into from
Apr 11, 2025

Conversation

DeaMariaLeon
Copy link
Contributor

@DeaMariaLeon DeaMariaLeon commented Apr 11, 2025

Reference Issues/PRs

Towards #22827

What does this implement/fix? Explain your changes.

Adds global random seeds to some tests

Any other comments?

cc @glemaitre

test_make_regression
test_make_regression_multitarget
test_make_blobs
test_make_blobs_n_samples_list_with_centers
test_make_friedman1
test_make_friedman2
test_make_friedman3
test_make_sparse_coded_signal
test_make_spd_matrix
test_make_swiss_roll
test_make_s_curve
test_make_moons
Copy link

github-actions bot commented Apr 11, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 881c684. Link to the linter CI: here

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @DeaMariaLeon

The other tests with randomness that were not updated to use global_random_seed don't test mathematical properties, just shapes and errors and stuff like that, so I'm fine with the list of updated tests.

X, y, c = make_regression(
n_samples=100,
n_samples=200,
Copy link
Member

Choose a reason for hiding this comment

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

I think it's okay to increase the size of the dataset here since we're testing the variance of the generated data, and so we need sufficient data points for it to be stable enough.

@jeremiedbb jeremiedbb enabled auto-merge (squash) April 11, 2025 15:11
@jeremiedbb jeremiedbb merged commit 7f55ecb into scikit-learn:main Apr 11, 2025
34 checks passed
@DeaMariaLeon DeaMariaLeon deleted the samplesg branch April 12, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants