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

bug in StratifiedKFold when shuffle=true #109

Open
SimonEnsemble opened this issue Feb 20, 2022 · 0 comments
Open

bug in StratifiedKFold when shuffle=true #109

SimonEnsemble opened this issue Feb 20, 2022 · 0 comments

Comments

@SimonEnsemble
Copy link

ScikitLearn v0.6.4

Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

using ScikitLearn.CrossValidation: train_test_split, StratifiedKFold, KFold

kf = KFold(10, n_folds=5, shuffle=true) # all is well

skf = StratifiedKFold([rand([-1, 1]) for i = 1:20], n_folds=5) # all is well

skf = StratifiedKFold([rand([-1, 1]) for i = 1:20], n_folds=5, shuffle=true) # error below
ERROR: ArgumentError: Random._GLOBAL_RNG() cannot be used to seed a MersenneTwister
Stacktrace:
 [1] check_random_state(seed::Random._GLOBAL_RNG)
   @ ScikitLearn.Skcore ~/.julia/packages/ScikitLearn/ssekP/src/cross_validation.jl:19
 [2] KFold(n::Int64; n_folds::Int64, shuffle::Bool, random_state::Random._GLOBAL_RNG)
   @ ScikitLearn.Skcore ~/.julia/packages/ScikitLearn/ssekP/src/cross_validation.jl:120
 [3] (::ScikitLearn.Skcore.var"#74#76"{Int64, Bool})(c::Int64)
   @ ScikitLearn.Skcore ./none:0
 [4] iterate
   @ ./generator.jl:47 [inlined]
 [5] collect(itr::Base.Generator{Vector{Int64}, ScikitLearn.Skcore.var"#74#76"{Int64, Bool}})
   @ Base ./array.jl:724
 [6] StratifiedKFold(y::Vector{Int64}; n_folds::Int64, shuffle::Bool, random_state::Nothing)
   @ ScikitLearn.Skcore ~/.julia/packages/ScikitLearn/ssekP/src/cross_validation.jl:160
 [7] top-level scope
   @ REPL[20]:1
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

No branches or pull requests

1 participant