From 25d35bb3f54ff007382a24cc52cd8ad75afd8911 Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Wed, 20 Sep 2023 06:01:00 +0000 Subject: [PATCH 1/9] build: bump compat for `ExtendableSparse` --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 04172e137..b5949bc6e 100644 --- a/Project.toml +++ b/Project.toml @@ -16,7 +16,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [compat] Distributions = "0.21, 0.22, 0.23, 0.24, 0.25" -ExtendableSparse = "0.4, 0.5, 0.6" +ExtendableSparse = "1" Flux = "0.12, 0.13" GLM = "1.3" IterativeSolvers = "0.9" From ae9ce1b0a3b6132d26640b36fdef7ef99b67fde4 Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Wed, 20 Sep 2023 06:01:35 +0000 Subject: [PATCH 2/9] build: fix version of `QuasiMonteCarlo` This is to test whether it passes CI with an earlier version or not --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index b5949bc6e..7534c5287 100644 --- a/Project.toml +++ b/Project.toml @@ -21,7 +21,7 @@ Flux = "0.12, 0.13" GLM = "1.3" IterativeSolvers = "0.9" PolyChaos = "0.2" -QuasiMonteCarlo = "0.2.14" +QuasiMonteCarlo = "=0.2.16" Zygote = "0.4, 0.5, 0.6" julia = "1.6" From 34e64df409c6fe81a98abfffd4248de57e6fa99a Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Wed, 20 Sep 2023 12:12:05 +0000 Subject: [PATCH 3/9] test: wrap testsets into one testset This is to ensure all testsets run even if one fails as they are independent --- test/runtests.jl | 54 +++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 08e80ab76..25abaf606 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,28 +8,34 @@ function dev_subpkg(subpkg) subpkg_path = joinpath(dirname(@__DIR__), "lib", subpkg) Pkg.develop(PackageSpec(path = subpkg_path)) end -for pkg in [ - "SurrogatesAbstractGPs", "SurrogatesFlux", - "SurrogatesPolyChaos", "SurrogatesMOE", - "SurrogatesRandomForest", "SurrogatesSVM"] - @time begin - dev_subpkg(pkg) - Pkg.test(pkg) - end -end -@time @safetestset "GEKPLS.jl" begin include("GEKPLS.jl") end -@time @safetestset "Radials.jl" begin include("Radials.jl") end -@time @safetestset "Kriging.jl" begin include("Kriging.jl") end -@time @safetestset "Sampling" begin include("sampling.jl") end -@time @safetestset "Optimization" begin include("optimization.jl") end -@time @safetestset "LinearSurrogate" begin include("linearSurrogate.jl") end -@time @safetestset "Lobachevsky" begin include("lobachevsky.jl") end -@time @safetestset "InverseDistanceSurrogate" begin include("inverseDistanceSurrogate.jl") end -@time @safetestset "SecondOrderPolynomialSurrogate" begin include("secondOrderPolynomialSurrogate.jl") end -# @time @safetestset "AD_Compatibility" begin include("AD_compatibility.jl") end -@time @safetestset "Wendland" begin include("Wendland.jl") end -@time @safetestset "VariableFidelity" begin include("VariableFidelity.jl") end -@time @safetestset "Earth" begin include("earth.jl") end -@time @safetestset "Gradient Enhanced Kriging" begin include("GEK.jl") end -@time @safetestset "Section Samplers" begin include("SectionSampleTests.jl") end +@testset "Surrogates" begin + @testset "Libs" begin + @testset "$pkg" for pkg in [ + "SurrogatesAbstractGPs", "SurrogatesFlux", + "SurrogatesPolyChaos", "SurrogatesMOE", + "SurrogatesRandomForest", "SurrogatesSVM"] + @time begin + dev_subpkg(pkg) + Pkg.test(pkg) + end + end + end + @testset "Algorithms" begin + @time @safetestset "GEKPLS" begin include("GEKPLS.jl") end + @time @safetestset "Radials" begin include("Radials.jl") end + @time @safetestset "Kriging" begin include("Kriging.jl") end + @time @safetestset "Sampling" begin include("sampling.jl") end + @time @safetestset "Optimization" begin include("optimization.jl") end + @time @safetestset "LinearSurrogate" begin include("linearSurrogate.jl") end + @time @safetestset "Lobachevsky" begin include("lobachevsky.jl") end + @time @safetestset "InverseDistanceSurrogate" begin include("inverseDistanceSurrogate.jl") end + @time @safetestset "SecondOrderPolynomialSurrogate" begin include("secondOrderPolynomialSurrogate.jl") end + # @time @safetestset "AD_Compatibility" begin include("AD_compatibility.jl") end + @time @safetestset "Wendland" begin include("Wendland.jl") end + @time @safetestset "VariableFidelity" begin include("VariableFidelity.jl") end + @time @safetestset "Earth" begin include("earth.jl") end + @time @safetestset "Gradient Enhanced Kriging" begin include("GEK.jl") end + @time @safetestset "Section Samplers" begin include("SectionSampleTests.jl") end + end +end \ No newline at end of file From ff5f158b9077b515efbe03afe3b97b98df6ad060 Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Wed, 20 Sep 2023 15:01:05 +0000 Subject: [PATCH 4/9] test: use Random seed for testing for `SurrogatesMOE` --- lib/SurrogatesMOE/test/runtests.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/SurrogatesMOE/test/runtests.jl b/lib/SurrogatesMOE/test/runtests.jl index 214333ef8..05e9c23aa 100644 --- a/lib/SurrogatesMOE/test/runtests.jl +++ b/lib/SurrogatesMOE/test/runtests.jl @@ -1,4 +1,6 @@ using SafeTestsets +using Random +Random.seed!(100) # #test 1D function that is discontinuous @safetestset "1D" begin From dbedd7c3c5bca62aa47e6f17b1e27d5178101340 Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Thu, 21 Sep 2023 03:58:58 +0000 Subject: [PATCH 5/9] build: add `StableRNGs` as test dep in `SurrogatesMOE` --- lib/SurrogatesMOE/Project.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/SurrogatesMOE/Project.toml b/lib/SurrogatesMOE/Project.toml index 44b51aaef..00748c991 100644 --- a/lib/SurrogatesMOE/Project.toml +++ b/lib/SurrogatesMOE/Project.toml @@ -28,8 +28,9 @@ XGBoost = "1.5.2" [extras] Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c" +StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" [targets] -test = ["Flux", "Test", "SafeTestsets"] \ No newline at end of file +test = ["Flux", "Test", "SafeTestsets", "StableRNGs"] \ No newline at end of file From 9c8f9608da7fda8a4132034e40df0a19f8c3fdae Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Thu, 21 Sep 2023 03:59:43 +0000 Subject: [PATCH 6/9] test: use `StableRNGs` in setting seed in `SurrogatesMOE` --- lib/SurrogatesMOE/test/runtests.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/SurrogatesMOE/test/runtests.jl b/lib/SurrogatesMOE/test/runtests.jl index 05e9c23aa..6e07d9b3e 100644 --- a/lib/SurrogatesMOE/test/runtests.jl +++ b/lib/SurrogatesMOE/test/runtests.jl @@ -1,6 +1,7 @@ using SafeTestsets -using Random -Random.seed!(100) +using StableRNGs, Random +const SEED = 42 +Random.seed!(StableRNG(SEED), SEED) # #test 1D function that is discontinuous @safetestset "1D" begin From 6848450d124afe005d13b4dc347c201eed2f9695 Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Thu, 21 Sep 2023 17:13:26 +0000 Subject: [PATCH 7/9] fix: `_extract_part` function Using `BitArray(undef, n)` won't give all falses --- lib/SurrogatesMOE/src/SurrogatesMOE.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/SurrogatesMOE/src/SurrogatesMOE.jl b/lib/SurrogatesMOE/src/SurrogatesMOE.jl index 1cbed8e6f..6d2c6cd87 100644 --- a/lib/SurrogatesMOE/src/SurrogatesMOE.jl +++ b/lib/SurrogatesMOE/src/SurrogatesMOE.jl @@ -33,8 +33,7 @@ end MOE(x, y, expert_types; ndim=1, n_clusters=2) constructor for MOE; takes in x, y and expert types and returns an MOE struct """ -function MOE(x, y, expert_types; ndim = 1, n_clusters = 2) - quantile = 10 +function MOE(x, y, expert_types; ndim = 1, n_clusters = 2, quantile = 10) if (ndim > 1) #x = _vector_of_tuples_to_matrix(x) X = _vector_of_tuples_to_matrix(x) @@ -141,7 +140,7 @@ end function _extract_part(values, quantile) num = size(values, 1) indices = collect(1:quantile:num) - mask = BitArray(undef, num) + mask = falses(num) mask[indices] .= true #mask return values[mask, :], values[.~mask, :] From 1ec6002130759e290106815454acf312ba3a84fe Mon Sep 17 00:00:00 2001 From: Sathvik Bhagavan Date: Thu, 21 Sep 2023 17:14:53 +0000 Subject: [PATCH 8/9] test: make quantile=5 for MOE 2D case --- lib/SurrogatesMOE/test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SurrogatesMOE/test/runtests.jl b/lib/SurrogatesMOE/test/runtests.jl index 6e07d9b3e..8344a44b5 100644 --- a/lib/SurrogatesMOE/test/runtests.jl +++ b/lib/SurrogatesMOE/test/runtests.jl @@ -85,7 +85,7 @@ end RadialBasisStructure(radial_function = linearRadial(), scale_factor = 1.0, sparse = false), ] - moe_nd_krig_rad = MOE(x, y, expert_types, ndim = 2) + moe_nd_krig_rad = MOE(x, y, expert_types, ndim = 2, quantile = 5) moe_pred_vals = moe_nd_krig_rad.(x_test) true_vals = discont_NDIM.(x_test) moe_rmse = rmse(true_vals, moe_pred_vals) From 8acff993c6ff77b9568e644cb89c1748868ea752 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Thu, 21 Sep 2023 15:03:37 -0400 Subject: [PATCH 9/9] Pull back XGBoost to match SurrogatesRandomForest --- docs/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Project.toml b/docs/Project.toml index 904023037..4093249c5 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -25,5 +25,5 @@ SurrogatesMOE = "0.1.0" SurrogatesPolyChaos = "0.1.0" SurrogatesRandomForest = "0.1.0" SurrogatesSVM = "0.1.0" -XGBoost = "2.1.0" +XGBoost = "1.5" Zygote = "0.6.49"