Skip to content

Commit

Permalink
Merge pull request #883 from JuliaAI/hyperparam-faulty-test
Browse files Browse the repository at this point in the history
Fix suspicious test that is failing on CI
  • Loading branch information
ablaom authored Feb 27, 2023
2 parents 0c71f32 + 910b1a2 commit a2fb85b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/hyperparam/one_dimensional_range_methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using Statistics
using StableRNGs

rng = StableRNG(66600099)
stable_rng() = StableRNG(123)

const Dist = Distributions

Expand Down Expand Up @@ -182,17 +183,16 @@ end
origin=5, unit=1) # origin and unit not relevant here
s = MLJBase.sampler(r, Dist.Normal())

Random.seed!(1);
v = rand(s, 1000)
rng = stable_rng()
v = rand(rng, s, 1000)
@test all(x >= 0.2 for x in v)
@test abs(minimum(v)/0.2 - 1) <= 0.02

rng = _default_rng(1);
rng = stable_rng()
@test rand(rng, s, 1000) == v

q = quantile(v, 0.0:0.1:1.0)
Random.seed!(1);
v2 = filter(x -> x>=0.2, rand(Dist.Normal(), 3000))[1:1000]
v2 = filter(x -> x>=0.2, rand(stable_rng(), Dist.Normal(), 3000))[1:1000]
q2 = quantile(v2, 0.0:0.1:1.0)
@test all(x -> x1.0, q ./ q2)
end
Expand Down

0 comments on commit a2fb85b

Please sign in to comment.