Skip to content

Commit

Permalink
Merge pull request #441 from sathvikbhagavan/sb/fix_tests
Browse files Browse the repository at this point in the history
Investigate test failures
  • Loading branch information
ChrisRackauckas authored Sep 21, 2023
2 parents c2fee00 + 8acff99 commit 1ee0a5c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 32 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ 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"
PolyChaos = "0.2"
QuasiMonteCarlo = "0.2.14"
QuasiMonteCarlo = "=0.2.16"
Zygote = "0.4, 0.5, 0.6"
julia = "1.6"

Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 2 additions & 1 deletion lib/SurrogatesMOE/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
test = ["Flux", "Test", "SafeTestsets", "StableRNGs"]
5 changes: 2 additions & 3 deletions lib/SurrogatesMOE/src/SurrogatesMOE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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, :]
Expand Down
5 changes: 4 additions & 1 deletion lib/SurrogatesMOE/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using SafeTestsets
using StableRNGs, Random
const SEED = 42
Random.seed!(StableRNG(SEED), SEED)

# #test 1D function that is discontinuous
@safetestset "1D" begin
Expand Down Expand Up @@ -82,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)
Expand Down
54 changes: 30 additions & 24 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1ee0a5c

Please sign in to comment.