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

Resampling strategies should have option for independent RNG #178

Closed
ablaom opened this issue Jul 1, 2019 · 0 comments · Fixed by #179
Closed

Resampling strategies should have option for independent RNG #178

ablaom opened this issue Jul 1, 2019 · 0 comments · Fixed by #179
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ablaom
Copy link
Member

ablaom commented Jul 1, 2019

Currently the global RNG is used in Holdout and CV, which is bad for reproducibility. I suggest we add an extra field to these strategies, rng which is an integer seed for a MersenneTwister (global RNG seed) or an arbitrary AbstractRNG object, as is done, for example, in DeterministicEnsembleModel. From that code:

mutable struct DeterministicEnsembleModel{Atom<:Deterministic} <: Deterministic
    atom::Atom
    weights::Vector{Float64}
    bagging_fraction::Float64
    rng::Union{Int,AbstractRNG}    # <----------
    n::Int
    parallel::Bool
    out_of_bag_measure # TODO: type this
end

And later in the fit method:

 ....
    if model.rng isa Integer
        rng = MersenneTwister(model.rng)
    else
        rng = model.rng
    end
... <code using rng to generate random numbers>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant