Skip to content
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

make random_state sklearn compliant #97

Merged
merged 4 commits into from
Nov 3, 2023
Merged

make random_state sklearn compliant #97

merged 4 commits into from
Nov 3, 2023

Conversation

rpreen
Copy link
Member

@rpreen rpreen commented Nov 3, 2023

Currently random_state can only be an integer value where <= 0 uses the system time and > 0 sets the seed.

This PR makes Python library random_state sklearn compliant:

  • random_state with an integer value < 0 uses system time as seed;
  • random_state with an integer value >= 0 will set the seed;
  • Python API maps random_state = None to -1 and uses system time as seed;

Note that are still some situations where setting the random number seed will not result in reproducible results, such as when using parallel processing and random numbers are used during forward propagation of neural nets (such as dropout layers.)

@rpreen rpreen linked an issue Nov 3, 2023 that may be closed by this pull request
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (dc9aea8) 61.89% compared to head (9ef69f6) 61.89%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #97   +/-   ##
=======================================
  Coverage   61.89%   61.89%           
=======================================
  Files          62       62           
  Lines        8894     8894           
  Branches     1073     1073           
=======================================
  Hits         5505     5505           
  Misses       3389     3389           
Files Coverage Δ
xcsf/param.c 84.49% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Nov 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@rpreen rpreen merged commit 94f3237 into master Nov 3, 2023
11 checks passed
@rpreen rpreen deleted the 96_random_state branch November 3, 2023 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

random_state parameter does not conform to sklearn interface
1 participant