Skip to content

[MRG] TST use global_random_seed in sklearn/ensemble/tests/test_gradient_boosting.py #23549

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

haochunchang
Copy link
Contributor

Reference Issues/PRs

Towards #22827

What does this implement/fix? Explain your changes.

  • Changes test_staged_functions_defensive and test_gradient_boosting_with_init to use global_random_seed.

Any other comments?

There is another place that uses np.random.RandomState(0) in line 52. It was used to permute Iris dataset.
I think it does not need to use global_random_seed since it was fixed to 0.
And it seems that it won't be affected by the env variable.

@haochunchang
Copy link
Contributor Author

Thanks for @glemaitre 's comments. I have added them and re-checked if other tests needs to use global_random_seed.
Hopefully the tests are checking important mathematical property.

test_classification_toy
test_classification_synthetic
test_regression_dataset
test_iris
test_regression_synthetic
test_probability_log
test_max_feature_regression
test_staged_functions_defensive
test_quantile_loss
test_warm_start
test_warm_start_n_estimators
test_warm_start_fortran
test_zero_estimator_reg
test_zero_estimator_clf
test_probability_exponential
test_classification_toy
test_classification_synthetic
test_regression_dataset
test_iris
test_regression_synthetic
test_probability_log
test_max_feature_regression
test_staged_functions_defensive
test_quantile_loss
test_warm_start
test_warm_start_n_estimators
test_warm_start_fortran
test_zero_estimator_reg
test_zero_estimator_clf
test_probability_exponential
test_classification_toy
test_classification_synthetic
test_regression_dataset
test_iris
test_regression_synthetic
test_probability_log
test_max_feature_regression
test_staged_functions_defensive
test_quantile_loss
test_warm_start
test_warm_start_n_estimators
test_warm_start_fortran
test_zero_estimator_reg
test_zero_estimator_clf
test_probability_exponential
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 @haochunchang. LGTM.

@jeremiedbb jeremiedbb merged commit 2577577 into scikit-learn:main Sep 25, 2022
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