-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
TST use global_random_seed in sklearn/decomposition/tests/test_factor_analysis.py #29272
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
TST use global_random_seed in sklearn/decomposition/tests/test_factor_analysis.py #29272
Conversation
@@ -57,7 +57,7 @@ def test_factor_analysis(): | |||
# Model Covariance | |||
mcov = fa.get_covariance() | |||
diff = np.sum(np.abs(scov - mcov)) / W.size | |||
assert diff < 0.1, "Mean absolute difference is %f" % diff | |||
assert diff < 0.2, "Mean absolute difference is %f" % diff |
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.
When I added the global_random_seed
fixture I got the following test failures:
FAILED sklearn/decomposition/tests/test_factor_analysis.py::test_factor_analysis[16] - AssertionError: Mean absolute difference is 0.170675
FAILED sklearn/decomposition/tests/test_factor_analysis.py::test_factor_analysis[38] - AssertionError: Mean absolute difference is 0.130926
FAILED sklearn/decomposition/tests/test_factor_analysis.py::test_factor_analysis[96] - AssertionError: Mean absolute difference is 0.134258
By increasing the threshold the failures are fixed. 0.2
looks acceptable to me but let me know if you disagree.
Thanks for the PR. Can you please run for all the seeds on the CI? |
I triggered the CI twice with the same results. The failures seem to be related to #29278 |
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!
Just in case (probably overcautious but oh well 😅) I pushed an empty commit to trigger a full CI. For completeness, you could imagine a very edge case scenario where the last commit has a green CI because it is running a single test with all global random seeds, but actually the last commit has broken some other tests ... |
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 @marenwestermann
Reference Issues/PRs
towards #22827
What does this implement/fix? Explain your changes.
I added the
global_random_seed
fixture to the testtest_factor_analysis
.Any other comments?
I haven't submitted anything myself in a while and thought I'll annoy you a bit. 😁