Skip to content

Commit 1ee0a5c

Browse files
Merge pull request #441 from sathvikbhagavan/sb/fix_tests
Investigate test failures
2 parents c2fee00 + 8acff99 commit 1ee0a5c

File tree

6 files changed

+41
-32
lines changed

6 files changed

+41
-32
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
1616

1717
[compat]
1818
Distributions = "0.21, 0.22, 0.23, 0.24, 0.25"
19-
ExtendableSparse = "0.4, 0.5, 0.6"
19+
ExtendableSparse = "1"
2020
Flux = "0.12, 0.13"
2121
GLM = "1.3"
2222
IterativeSolvers = "0.9"
2323
PolyChaos = "0.2"
24-
QuasiMonteCarlo = "0.2.14"
24+
QuasiMonteCarlo = "=0.2.16"
2525
Zygote = "0.4, 0.5, 0.6"
2626
julia = "1.6"
2727

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ SurrogatesMOE = "0.1.0"
2525
SurrogatesPolyChaos = "0.1.0"
2626
SurrogatesRandomForest = "0.1.0"
2727
SurrogatesSVM = "0.1.0"
28-
XGBoost = "2.1.0"
28+
XGBoost = "1.5"
2929
Zygote = "0.6.49"

lib/SurrogatesMOE/Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ XGBoost = "1.5.2"
2828

2929
[extras]
3030
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
31+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
3132
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3233
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
3334

3435
[targets]
35-
test = ["Flux", "Test", "SafeTestsets"]
36+
test = ["Flux", "Test", "SafeTestsets", "StableRNGs"]

lib/SurrogatesMOE/src/SurrogatesMOE.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ end
3333
MOE(x, y, expert_types; ndim=1, n_clusters=2)
3434
constructor for MOE; takes in x, y and expert types and returns an MOE struct
3535
"""
36-
function MOE(x, y, expert_types; ndim = 1, n_clusters = 2)
37-
quantile = 10
36+
function MOE(x, y, expert_types; ndim = 1, n_clusters = 2, quantile = 10)
3837
if (ndim > 1)
3938
#x = _vector_of_tuples_to_matrix(x)
4039
X = _vector_of_tuples_to_matrix(x)
@@ -141,7 +140,7 @@ end
141140
function _extract_part(values, quantile)
142141
num = size(values, 1)
143142
indices = collect(1:quantile:num)
144-
mask = BitArray(undef, num)
143+
mask = falses(num)
145144
mask[indices] .= true
146145
#mask
147146
return values[mask, :], values[.~mask, :]

lib/SurrogatesMOE/test/runtests.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using SafeTestsets
2+
using StableRNGs, Random
3+
const SEED = 42
4+
Random.seed!(StableRNG(SEED), SEED)
25

36
# #test 1D function that is discontinuous
47
@safetestset "1D" begin
@@ -82,7 +85,7 @@ end
8285
RadialBasisStructure(radial_function = linearRadial(), scale_factor = 1.0,
8386
sparse = false),
8487
]
85-
moe_nd_krig_rad = MOE(x, y, expert_types, ndim = 2)
88+
moe_nd_krig_rad = MOE(x, y, expert_types, ndim = 2, quantile = 5)
8689
moe_pred_vals = moe_nd_krig_rad.(x_test)
8790
true_vals = discont_NDIM.(x_test)
8891
moe_rmse = rmse(true_vals, moe_pred_vals)

test/runtests.jl

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,34 @@ function dev_subpkg(subpkg)
88
subpkg_path = joinpath(dirname(@__DIR__), "lib", subpkg)
99
Pkg.develop(PackageSpec(path = subpkg_path))
1010
end
11-
for pkg in [
12-
"SurrogatesAbstractGPs", "SurrogatesFlux",
13-
"SurrogatesPolyChaos", "SurrogatesMOE",
14-
"SurrogatesRandomForest", "SurrogatesSVM"]
15-
@time begin
16-
dev_subpkg(pkg)
17-
Pkg.test(pkg)
18-
end
19-
end
2011

21-
@time @safetestset "GEKPLS.jl" begin include("GEKPLS.jl") end
22-
@time @safetestset "Radials.jl" begin include("Radials.jl") end
23-
@time @safetestset "Kriging.jl" begin include("Kriging.jl") end
24-
@time @safetestset "Sampling" begin include("sampling.jl") end
25-
@time @safetestset "Optimization" begin include("optimization.jl") end
26-
@time @safetestset "LinearSurrogate" begin include("linearSurrogate.jl") end
27-
@time @safetestset "Lobachevsky" begin include("lobachevsky.jl") end
28-
@time @safetestset "InverseDistanceSurrogate" begin include("inverseDistanceSurrogate.jl") end
29-
@time @safetestset "SecondOrderPolynomialSurrogate" begin include("secondOrderPolynomialSurrogate.jl") end
30-
# @time @safetestset "AD_Compatibility" begin include("AD_compatibility.jl") end
31-
@time @safetestset "Wendland" begin include("Wendland.jl") end
32-
@time @safetestset "VariableFidelity" begin include("VariableFidelity.jl") end
33-
@time @safetestset "Earth" begin include("earth.jl") end
34-
@time @safetestset "Gradient Enhanced Kriging" begin include("GEK.jl") end
35-
@time @safetestset "Section Samplers" begin include("SectionSampleTests.jl") end
12+
@testset "Surrogates" begin
13+
@testset "Libs" begin
14+
@testset "$pkg" for pkg in [
15+
"SurrogatesAbstractGPs", "SurrogatesFlux",
16+
"SurrogatesPolyChaos", "SurrogatesMOE",
17+
"SurrogatesRandomForest", "SurrogatesSVM"]
18+
@time begin
19+
dev_subpkg(pkg)
20+
Pkg.test(pkg)
21+
end
22+
end
23+
end
24+
@testset "Algorithms" begin
25+
@time @safetestset "GEKPLS" begin include("GEKPLS.jl") end
26+
@time @safetestset "Radials" begin include("Radials.jl") end
27+
@time @safetestset "Kriging" begin include("Kriging.jl") end
28+
@time @safetestset "Sampling" begin include("sampling.jl") end
29+
@time @safetestset "Optimization" begin include("optimization.jl") end
30+
@time @safetestset "LinearSurrogate" begin include("linearSurrogate.jl") end
31+
@time @safetestset "Lobachevsky" begin include("lobachevsky.jl") end
32+
@time @safetestset "InverseDistanceSurrogate" begin include("inverseDistanceSurrogate.jl") end
33+
@time @safetestset "SecondOrderPolynomialSurrogate" begin include("secondOrderPolynomialSurrogate.jl") end
34+
# @time @safetestset "AD_Compatibility" begin include("AD_compatibility.jl") end
35+
@time @safetestset "Wendland" begin include("Wendland.jl") end
36+
@time @safetestset "VariableFidelity" begin include("VariableFidelity.jl") end
37+
@time @safetestset "Earth" begin include("earth.jl") end
38+
@time @safetestset "Gradient Enhanced Kriging" begin include("GEK.jl") end
39+
@time @safetestset "Section Samplers" begin include("SectionSampleTests.jl") end
40+
end
41+
end

0 commit comments

Comments
 (0)