-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
TST use global_random_seed in sklearn/utils/tests/test_stats.py #30857
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
Conversation
test_averaged_weighted_percentile test_weighted_median_equal_weights test_weighted_median_integer_weights test_weighted_percentile_2d
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.
Thanks for the PR @Rishab260
Please also add a commit with all global seeds for the respective tests on this PR too.
test_averaged_weighted_percentile test_weighted_median_equal_weights test_weighted_median_integer_weights test_weighted_percentile_2d
test_averaged_weighted_percentile test_weighted_median_equal_weights test_weighted_median_integer_weights test_weighted_percentile_2d
Currently blocked by
Will fix this ASAP. |
test_averaged_weighted_percentile test_weighted_median_equal_weights test_weighted_median_integer_weights test_weighted_percentile_2d
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.
LGTM. Thanks @Rishab260
sklearn/utils/tests/test_stats.py
Outdated
x = rng.randint(20, size=1000) | ||
weights = rng.choice(5, size=1000) |
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.
Would size=100 work or does that still fail? I think 1000 is fine anyways.
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.
Hi, Size 100 failed, we can probably relax the tolerance but since size 1000 worked, I went with that one.
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.
The test was not correct. It is not equivalent to np.median when the number of effective samples is even. _averaged_weighted_percentile
should be equivalent instead. I modified the test accordingly.
test_averaged_weighted_percentile test_weighted_median_equal_weights test_weighted_median_integer_weights test_weighted_percentile_2d test_weighted_percentile_array_api_consistency test_weighted_percentile_nan_filtered test_weighted_percentile_like_numpy_quantile test_weighted_percentile_like_numpy_nanquantile
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.
LGTM. Thanks @Rishab260
Reference Issues/PRs
towards #22827
What does this implement/fix? Explain your changes.
I added the global_random_seed fixture to the following tests:-
Any other comments?
Feedback and guidance is highly appreciated. Looking forward to contributing to this project more and more in the coming days. Thanks in advance!