Skip to content

TST random seed global /svm/tests/test_svm.py #25891

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

Open
wants to merge 233 commits into
base: main
Choose a base branch
from

Conversation

Veghit
Copy link
Contributor

@Veghit Veghit commented Mar 17, 2023

Reference Issues/PRs
Towards #22827

What does this implement/fix? Explain your changes.
using random global seed for sklearn/svm/tests/test_svm.py to enable better testing.

Any other comments?
tests pass without logic changes. Decided to use global seed also for the test_svc_nonfinite_params test as it does not take much time and has some potential issues even though it is a simple test.

@Veghit Veghit changed the title Tst random seed global svm TST random seed global svm Mar 17, 2023
@Veghit Veghit changed the title TST random seed global svm TST random seed global /svm/tests/test_svm.py Mar 17, 2023
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.

Thanks for the PR @Veghit. There are many tests in this file that could use the global_random_seed since they currently use a fixed random_state

Comment on lines 1076 to 1077
X = np.random.RandomState(global_random_seed).randn(10, 3)
y = np.random.RandomState(global_random_seed + 1).randn(10)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
X = np.random.RandomState(global_random_seed).randn(10, 3)
y = np.random.RandomState(global_random_seed + 1).randn(10)
rng = np.random.RandomState(global_random_seed)
X = rng.randn(10, 3)
y = rng.randn(10)

dvignesh1995 and others added 28 commits April 15, 2023 23:06
…t-learn#26166)

Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
…cikit-learn#26165)

Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
…butions (scikit-learn#26161)

Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
Co-authored-by: jeremie du boisberranger <jeremiedbb@yahoo.fr>
… TST_random_seed_global_svm

# Conflicts:
#	sklearn/svm/tests/test_svm.py
@Veghit
Copy link
Contributor Author

Veghit commented Apr 16, 2023

@jeremiedbb fixed the rest of the tests

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.