Skip to content

Issue#22827 - Added global_random_seed to test functions #31317

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 11 commits into
base: main
Choose a base branch
from

Conversation

HakimTaoufik
Copy link

I picked up on the Issue#22827 and added global_random_seed to functions that use RandomState.

All my changes were in the sklearn/ensemble/_hist_gradient_boosting/tests/ directory/
Most of the functions were changed to add the global_random_seed, but some produced errors when changing so I kept them as they were.
All the tests passed after the changes and now the following python files are cleared from the issue :

  • sklearn/ensemble/_hist_gradient_boosting/tests/test_binning.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_bitset.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_compare_lightgbm.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_grower.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_histogram.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_monotonic_contraints.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_predictor.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_splitting.py
  • sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py

sklearn/ensemble/_hist_gradient_boosting/tests/test_binning.py instead
of 42
sklearn/ensemble/_hist_gradient_boosting/tests/test_compare_lightgbm.py,
however all tests for global_random_seed were skipped by the command :
SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all" pytest
sklearn/ensemble/_hist_gradient_boosting/tests/test_compare_lightgbm.py -k test_some_function
sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py
tests; all changed functions passed all tests, the functions, where
adding global_random_seed couldn't pass the tests, were not changed
sklearn/ensemble/_hist_gradient_boosting/tests/test_grower.py, all
changed functions passed all tests.
sklearn/ensemble/_hist_gradient_boosting/tests/test_histogram.py. all
changed functions pass all tests.
sklearn/ensemble/_hist_gradient_boosting/tests/test_monotonic_constraints.py,
all functions with global_random_seed pass all tests
sklearn/ensemble/_hist_gradient_boosting/tests/test_splitting.py, all
changed functions pass all tests
test_split_interaction_constraints in
sklearn/ensemble/_hist_gradient_boosting/tests/test_splitting.py, all
tests passed
sklearn/ensemble/_hist_gradient_boosting/tests/test_warm_start.py, all
tests passed for the changed function (test_random_seeds_warm_start)
Copy link

github-actions bot commented May 6, 2025

✔️ Linting Passed

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

Generated for commit: 98230f0. Link to the linter CI: here

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.

1 participant