Skip to content

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)

@Veghit
Copy link
Contributor Author

Veghit commented Apr 16, 2023

@jeremiedbb fixed the rest of the tests

test_libsvm_iris
test_precomputed
test_linearsvr_fit_sampleweight
test_oneclass_decision_function
test_probability
test_decision_function
test_decision_function_shape
test_svr_predict
test_weight
test_auto_weight
test_bad_input
test_svc_nonfinite_params
test_unicode_kernel
test_linearsvc_parameters
test_linearsvc
test_linearsvc_crammer_singer
test_linearsvc_fit_sampleweight
test_crammer_singer_binary
test_linearsvc_iris
test_liblinear_set_coef
test_immutable_coef_property
test_svc_clone_with_callable_kernel
test_libsvm_convergence_warnings
test_consistent_proba
test_linear_svm_convergence_warnings
test_svr_coef_sign
test_hasattr_predict_proba
test_decision_function_shape_two_class
test_svc_invalid_break_ties_param
test_svc_ovr_tie_breaking
test_linearsvm_liblinear_sample_weight
test_n_iter_libsvm
test_svm_with_infinite_C
@github-actions
Copy link

github-actions bot commented Jul 28, 2025

✔️ Linting Passed

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

Generated for commit: d34e5c3. Link to the linter CI: here

    test_libsvm_iris
    test_precomputed
    test_linearsvr_fit_sampleweight
    test_oneclass_decision_function
    test_probability
    test_decision_function
    test_decision_function_shape
    test_svr_predict
    test_weight
    test_auto_weight
    test_bad_input
    test_svc_nonfinite_params
    test_unicode_kernel
    test_linearsvc_parameters
    test_linearsvc
    test_linearsvc_crammer_singer
    test_linearsvc_fit_sampleweight
    test_crammer_singer_binary
    test_linearsvc_iris
    test_liblinear_set_coef
    test_immutable_coef_property
    test_svc_clone_with_callable_kernel
    test_libsvm_convergence_warnings
    test_consistent_proba
    test_linear_svm_convergence_warnings
    test_svr_coef_sign
    test_hasattr_predict_proba
    test_decision_function_shape_two_class
    test_svc_invalid_break_ties_param
    test_svc_ovr_tie_breaking
    test_linearsvm_liblinear_sample_weight
    test_n_iter_libsvm
    test_svm_with_infinite_C
    test_libsvm_iris
    test_precomputed
    test_linearsvr_fit_sampleweight
    test_oneclass_decision_function
    test_probability
    test_decision_function
    test_decision_function_shape
    test_svr_predict
    test_weight
    test_auto_weight
    test_bad_input
    test_svc_nonfinite_params
    test_unicode_kernel
    test_linearsvc_parameters
    test_linearsvc
    test_linearsvc_crammer_singer
    test_linearsvc_fit_sampleweight
    test_crammer_singer_binary
    test_linearsvc_iris
    test_liblinear_set_coef
    test_immutable_coef_property
    test_svc_clone_with_callable_kernel
    test_libsvm_convergence_warnings
    test_consistent_proba
    test_linear_svm_convergence_warnings
    test_svr_coef_sign
    test_hasattr_predict_proba
    test_decision_function_shape_two_class
    test_svc_invalid_break_ties_param
    test_svc_ovr_tie_breaking
    test_linearsvm_liblinear_sample_weight
    test_n_iter_libsvm
    test_svm_with_infinite_C
    test_libsvm_iris
    test_precomputed
    test_linearsvr_fit_sampleweight
    test_probability
    test_decision_function
    test_decision_function_shape
    test_svr_predict
    test_bad_input
    test_svc_nonfinite_params
    test_unicode_kernel
    test_linearsvc_parameters
    test_linearsvc
    test_linearsvc_crammer_singer
    test_linearsvc_fit_sampleweight
    test_crammer_singer_binary
    test_linearsvc_iris
    test_liblinear_set_coef
    test_immutable_coef_property
    test_svc_clone_with_callable_kernel
    test_libsvm_convergence_warnings
    test_consistent_proba
    test_linear_svm_convergence_warnings
    test_svr_coef_sign
    test_hasattr_predict_proba
    test_decision_function_shape_two_class
    test_svc_invalid_break_ties_param
    test_svc_ovr_tie_breaking
    test_linearsvm_liblinear_sample_weight
    test_n_iter_libsvm
    test_svm_with_infinite_C
    test_libsvm_iris
    test_precomputed
    test_linearsvr_fit_sampleweight
    test_probability
    test_decision_function
    test_decision_function_shape
    test_svr_predict
    test_bad_input
    test_svc_nonfinite_params
    test_unicode_kernel
    test_linearsvc_parameters
    test_linearsvc
    test_linearsvc_crammer_singer
    test_linearsvc_fit_sampleweight
    test_crammer_singer_binary
    test_linearsvc_iris
    test_liblinear_set_coef
    test_immutable_coef_property
    test_svc_clone_with_callable_kernel
    test_libsvm_convergence_warnings
    test_consistent_proba
    test_linear_svm_convergence_warnings
    test_svr_coef_sign
    test_hasattr_predict_proba
    test_decision_function_shape_two_class
    test_svc_invalid_break_ties_param
    test_svc_ovr_tie_breaking
    test_linearsvm_liblinear_sample_weight
    test_n_iter_libsvm
    test_svm_with_infinite_C
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 !

@jeremiedbb jeremiedbb enabled auto-merge (squash) August 1, 2025 11:45
@jeremiedbb jeremiedbb merged commit e8ab263 into scikit-learn:main Aug 1, 2025
36 checks passed
lucyleeow pushed a commit to lucyleeow/scikit-learn that referenced this pull request Aug 22, 2025
@jeremiedbb jeremiedbb mentioned this pull request Sep 3, 2025
13 tasks
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.