From 52a924d837e4ffffcf6d4d6d44da347fe0988cfa Mon Sep 17 00:00:00 2001 From: Vaibhav Kumar Dixit Date: Fri, 17 May 2024 19:16:44 -0400 Subject: [PATCH 01/12] Update sobol_sensitivity.jl --- src/sobol_sensitivity.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index 88631a1a..b4800a4a 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -346,6 +346,7 @@ function gsa(f, method::Sobol, p_range::AbstractVector; samples, kwargs...) AB = QuasiMonteCarlo.generate_design_matrices(samples, [i[1] for i in p_range], [i[2] for i in p_range], QuasiMonteCarlo.SobolSample(), + QuasiMonteCarlo.OwenScramble(), 2 * method.nboot) A = reduce(hcat, @view(AB[1:(method.nboot)])) B = reduce(hcat, @view(AB[(method.nboot + 1):end])) From 8142a185f8b91645940375e36ff72b215d45bd3f Mon Sep 17 00:00:00 2001 From: Vaibhav Kumar Dixit Date: Sat, 18 May 2024 12:49:55 -0400 Subject: [PATCH 02/12] Update src/sobol_sensitivity.jl Co-authored-by: David Widmann --- src/sobol_sensitivity.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index b4800a4a..321f5857 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -346,7 +346,7 @@ function gsa(f, method::Sobol, p_range::AbstractVector; samples, kwargs...) AB = QuasiMonteCarlo.generate_design_matrices(samples, [i[1] for i in p_range], [i[2] for i in p_range], QuasiMonteCarlo.SobolSample(), - QuasiMonteCarlo.OwenScramble(), + QuasiMonteCarlo.OwenScramble(; base=2, pad=ceil(Int, log2(samples)), rng), 2 * method.nboot) A = reduce(hcat, @view(AB[1:(method.nboot)])) B = reduce(hcat, @view(AB[(method.nboot + 1):end])) From 846f306c8a2d74dbc04ed6c061f19c2801bb09b6 Mon Sep 17 00:00:00 2001 From: Vaibhav Kumar Dixit Date: Sat, 18 May 2024 12:51:26 -0400 Subject: [PATCH 03/12] Update sobol_sensitivity.jl --- src/sobol_sensitivity.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index 321f5857..4bac584b 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -342,7 +342,7 @@ function gsa_sobol_all_y_analysis(method, all_y::AbstractArray{T}, d, n, Ei_esti nboot > 1 ? reshape(ST_CI, size_...) : nothing) end -function gsa(f, method::Sobol, p_range::AbstractVector; samples, kwargs...) +function gsa(f, method::Sobol, p_range::AbstractVector; samples, rng::AbstractRNG = Random.default_rng(), kwargs...) AB = QuasiMonteCarlo.generate_design_matrices(samples, [i[1] for i in p_range], [i[2] for i in p_range], QuasiMonteCarlo.SobolSample(), From a0d93641099748dad5f1ef2056705321cd79f6c7 Mon Sep 17 00:00:00 2001 From: Vaibhav Kumar Dixit Date: Mon, 20 May 2024 11:45:39 -0400 Subject: [PATCH 04/12] Update src/sobol_sensitivity.jl Co-authored-by: David Widmann --- src/sobol_sensitivity.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index 4bac584b..54a6b816 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -345,8 +345,7 @@ end function gsa(f, method::Sobol, p_range::AbstractVector; samples, rng::AbstractRNG = Random.default_rng(), kwargs...) AB = QuasiMonteCarlo.generate_design_matrices(samples, [i[1] for i in p_range], [i[2] for i in p_range], - QuasiMonteCarlo.SobolSample(), - QuasiMonteCarlo.OwenScramble(; base=2, pad=ceil(Int, log2(samples)), rng), + QuasiMonteCarlo.SobolSample(; R=QuasiMonteCarlo.OwenScramble(; base=2, pad=ceil(Int, log2(samples)), rng)), 2 * method.nboot) A = reduce(hcat, @view(AB[1:(method.nboot)])) B = reduce(hcat, @view(AB[(method.nboot + 1):end])) From 04ab43b8f5c1b65ab48cc7190e7c446681b38cd2 Mon Sep 17 00:00:00 2001 From: Vaibhav Dixit Date: Wed, 29 May 2024 19:35:38 -0400 Subject: [PATCH 05/12] Change number of samples in sobol to 2^n and fix shapley indexing --- src/shapley_sensitivity.jl | 4 ++++ src/sobol_sensitivity.jl | 8 +++++++- test/shapley_method.jl | 12 ++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/shapley_sensitivity.jl b/src/shapley_sensitivity.jl index 9f790e69..df1ad2a8 100644 --- a/src/shapley_sensitivity.jl +++ b/src/shapley_sensitivity.jl @@ -203,6 +203,10 @@ function gsa(f, method::Shapley, input_distribution::SklarDist; batch = false) sample_complement = rand( Copulas.subsetdims(input_distribution, idx_minus), n_outer) + if size(sample_complement, 2) == 1 + sample_complement = reshape(sample_complement, (1, length(sample_complement))) + end + for l in 1:n_outer curr_sample = @view sample_complement[:, l] # Sampling of the set conditionally to the complementary element diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index 54a6b816..d4ca6b54 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -343,9 +343,15 @@ function gsa_sobol_all_y_analysis(method, all_y::AbstractArray{T}, d, n, Ei_esti end function gsa(f, method::Sobol, p_range::AbstractVector; samples, rng::AbstractRNG = Random.default_rng(), kwargs...) + log2num = ceil(Int, log2(samples)) + samples2n = 2^log2num + if samples2n != samples + samples = samples2n + @warn "Passed samples is not a power of 2, number of sample points changed to $samples" + end AB = QuasiMonteCarlo.generate_design_matrices(samples, [i[1] for i in p_range], [i[2] for i in p_range], - QuasiMonteCarlo.SobolSample(; R=QuasiMonteCarlo.OwenScramble(; base=2, pad=ceil(Int, log2(samples)), rng)), + QuasiMonteCarlo.SobolSample(; R=QuasiMonteCarlo.OwenScramble(; base=2, pad=log2num, rng)), 2 * method.nboot) A = reduce(hcat, @view(AB[1:(method.nboot)])) B = reduce(hcat, @view(AB[(method.nboot + 1):end])) diff --git a/test/shapley_method.jl b/test/shapley_method.jl index 06a382bd..1cfb6a79 100644 --- a/test/shapley_method.jl +++ b/test/shapley_method.jl @@ -25,8 +25,8 @@ n_perms = -1; n_var = 10_000; n_outer = 1000; n_inner = 3; -dim = 3; -margins = (Uniform(-pi, pi), Uniform(-pi, pi), Uniform(-pi, pi)); +dim = 4; +margins = (Uniform(-pi, pi), Uniform(-pi, pi), Uniform(-pi, pi), Uniform(-pi, pi)); dependency_matrix = Matrix(4 * I, dim, dim); C = GaussianCopula(dependency_matrix); input_distribution = SklarDist(C, margins); @@ -41,8 +41,8 @@ method = Shapley(n_perms = n_perms, @test result.shapley_effects[1]≈0.43813841765976547 atol=1e-1 @test result.shapley_effects[2]≈0.44673952698721386 atol=1e-1 -@test result.shapley_effects[3]≈0.23144736934254417 atol=1e-1 -# @test result.shapley_effects[4]≈0.0 atol=1e-1 +@test result.shapley_effects[3]≈0.11855122481995543 atol=1e-1 +@test result.shapley_effects[4]≈0.0 atol=1e-1 #<---- non batch #---> batch @@ -50,8 +50,8 @@ result = gsa(ishi_batch, method, input_distribution, batch = true); @test result.shapley_effects[1]≈0.44080027198796035 atol=1e-1 @test result.shapley_effects[2]≈0.43029987176805085 atol=1e-1 -@test result.shapley_effects[3]≈0.23144736934254417 atol=1e-1 -# @test result.shapley_effects[4]≈0.0 atol=1e-1 +@test result.shapley_effects[3]≈0.11855122481995543 atol=1e-1 +@test result.shapley_effects[4]≈0.0 atol=1e-1 #<--- batch d = 3 From d060c3c04212a5d35fe9ddde85fade6161cb30e7 Mon Sep 17 00:00:00 2001 From: Vaibhav Dixit Date: Wed, 29 May 2024 19:57:55 -0400 Subject: [PATCH 06/12] rem old qmc support --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 46c79594..f51a3f89 100644 --- a/Project.toml +++ b/Project.toml @@ -31,7 +31,7 @@ KernelDensity = "0.6.4" LinearAlgebra = "1.10" OrdinaryDiffEq = "6.62" Parameters = "0.12" -QuasiMonteCarlo = "0.2.3, 0.3" +QuasiMonteCarlo = "0.3" Random = "1.10" RecursiveArrayTools = "3.2" SafeTestsets = "0.1" From 8fa44eb65c144a427913c98b6acdfec3371623f0 Mon Sep 17 00:00:00 2001 From: Vaibhav Dixit Date: Wed, 29 May 2024 20:00:30 -0400 Subject: [PATCH 07/12] format --- Project.toml | 2 +- docs/src/tutorials/shapley.md | 8 ++++---- src/shapley_sensitivity.jl | 3 ++- src/sobol_sensitivity.jl | 6 ++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index f51a3f89..dbc42988 100644 --- a/Project.toml +++ b/Project.toml @@ -31,7 +31,7 @@ KernelDensity = "0.6.4" LinearAlgebra = "1.10" OrdinaryDiffEq = "6.62" Parameters = "0.12" -QuasiMonteCarlo = "0.3" +QuasiMonteCarlo = "0.3.3" Random = "1.10" RecursiveArrayTools = "3.2" SafeTestsets = "0.1" diff --git a/docs/src/tutorials/shapley.md b/docs/src/tutorials/shapley.md index d793d10a..d0afa958 100644 --- a/docs/src/tutorials/shapley.md +++ b/docs/src/tutorials/shapley.md @@ -128,8 +128,8 @@ barplot( xticklabelrotation = 1, xticks = (1:54, ["θ$i" for i in 1:54]), ylabel = "Shapley Indices", - limits = (nothing, (0.0, 0.2)), - ), + limits = (nothing, (0.0, 0.2)) + ) ) ``` @@ -160,7 +160,7 @@ barplot( xticklabelrotation = 1, xticks = (1:54, ["θ$i" for i in 1:54]), ylabel = "Shapley Indices", - limits = (nothing, (0.0, 0.2)), - ), + limits = (nothing, (0.0, 0.2)) + ) ) ``` diff --git a/src/shapley_sensitivity.jl b/src/shapley_sensitivity.jl index df1ad2a8..a7a59ba3 100644 --- a/src/shapley_sensitivity.jl +++ b/src/shapley_sensitivity.jl @@ -204,7 +204,8 @@ function gsa(f, method::Shapley, input_distribution::SklarDist; batch = false) Copulas.subsetdims(input_distribution, idx_minus), n_outer) if size(sample_complement, 2) == 1 - sample_complement = reshape(sample_complement, (1, length(sample_complement))) + sample_complement = reshape( + sample_complement, (1, length(sample_complement))) end for l in 1:n_outer diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index d4ca6b54..f22107b1 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -342,7 +342,8 @@ function gsa_sobol_all_y_analysis(method, all_y::AbstractArray{T}, d, n, Ei_esti nboot > 1 ? reshape(ST_CI, size_...) : nothing) end -function gsa(f, method::Sobol, p_range::AbstractVector; samples, rng::AbstractRNG = Random.default_rng(), kwargs...) +function gsa(f, method::Sobol, p_range::AbstractVector; samples, + rng::AbstractRNG = Random.default_rng(), kwargs...) log2num = ceil(Int, log2(samples)) samples2n = 2^log2num if samples2n != samples @@ -351,7 +352,8 @@ function gsa(f, method::Sobol, p_range::AbstractVector; samples, rng::AbstractRN end AB = QuasiMonteCarlo.generate_design_matrices(samples, [i[1] for i in p_range], [i[2] for i in p_range], - QuasiMonteCarlo.SobolSample(; R=QuasiMonteCarlo.OwenScramble(; base=2, pad=log2num, rng)), + QuasiMonteCarlo.SobolSample(; + R = QuasiMonteCarlo.OwenScramble(; base = 2, pad = log2num, rng)), 2 * method.nboot) A = reduce(hcat, @view(AB[1:(method.nboot)])) B = reduce(hcat, @view(AB[(method.nboot + 1):end])) From ff2dc3cb5a1f23c25b37b1e2de0ee4aebf5fb7eb Mon Sep 17 00:00:00 2001 From: Vaibhav Kumar Dixit Date: Wed, 29 May 2024 20:23:58 -0400 Subject: [PATCH 08/12] Update src/sobol_sensitivity.jl Co-authored-by: David Widmann --- src/sobol_sensitivity.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index f22107b1..aaad11c8 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -344,12 +344,12 @@ end function gsa(f, method::Sobol, p_range::AbstractVector; samples, rng::AbstractRNG = Random.default_rng(), kwargs...) - log2num = ceil(Int, log2(samples)) - samples2n = 2^log2num + samples2n = nextpow(2, samples) if samples2n != samples samples = samples2n @warn "Passed samples is not a power of 2, number of sample points changed to $samples" end + log2num = round(Int, log2(samples)) AB = QuasiMonteCarlo.generate_design_matrices(samples, [i[1] for i in p_range], [i[2] for i in p_range], QuasiMonteCarlo.SobolSample(; From 65f5d8d87ee84ef4957b7be8bf3f603bb6dfba8f Mon Sep 17 00:00:00 2001 From: Vaibhav Dixit Date: Wed, 29 May 2024 20:54:39 -0400 Subject: [PATCH 09/12] Docs and tests --- docs/src/tutorials/juliacon21.md | 10 +++++----- docs/src/tutorials/parallelized_gsa.md | 6 +++--- src/sobol_sensitivity.jl | 6 +++++- test/sobol_method.jl | 4 ++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/src/tutorials/juliacon21.md b/docs/src/tutorials/juliacon21.md index a91100d1..6923f881 100644 --- a/docs/src/tutorials/juliacon21.md +++ b/docs/src/tutorials/juliacon21.md @@ -5,7 +5,7 @@ We showcase how to use multiple GSA methods, analyze their results and leverage perform Global Sensitivity analysis at scale. ```@example lv -using GlobalSensitivity, QuasiMonteCarlo, OrdinaryDiffEq, Statistics, CairoMakie +using GlobalSensitivity, QuasiMonteCarlo, OrdinaryDiffEq, Statistics, CairoMakie, Random function f(du, u, p, t) du[1] = p[1] * u[1] - p[2] * u[1] * u[2] #prey @@ -54,7 +54,7 @@ fig ``` ```@example lv -sobol_sens = gsa(f1, Sobol(), bounds, samples = 500) +sobol_sens = gsa(f1, Sobol(), bounds, samples = 512) efast_sens = gsa(f1, eFAST(), bounds, samples = 500) ``` @@ -94,10 +94,10 @@ fig ```@example lv using QuasiMonteCarlo -samples = 500 +samples = 512 lb = [1.0, 1.0, 1.0, 1.0] ub = [5.0, 5.0, 5.0, 5.0] -sampler = SobolSample() +sampler = SobolSample(; R = QuasiMonteCarlo.OwenScramble(; base = 2, pad = 9, rng = _rng)) A, B = QuasiMonteCarlo.generate_design_matrices(samples, lb, ub, sampler) sobol_sens_desmat = gsa(f1, Sobol(), A, B) @@ -129,7 +129,7 @@ f1 = function (p) prob1 = remake(prob; p = p) sol = solve(prob1, Tsit5(); saveat = t) end -sobol_sens = gsa(f1, Sobol(nboot = 20), bounds, samples = 500) +sobol_sens = gsa(f1, Sobol(nboot = 20), bounds, samples = 512) fig = Figure(resolution = (600, 400)) ax, hm = CairoMakie.scatter( fig[1, 1], sobol_sens.S1[1][1, 2:end], label = "Prey", markersize = 4) diff --git a/docs/src/tutorials/parallelized_gsa.md b/docs/src/tutorials/parallelized_gsa.md index 64db8035..5b83ffca 100644 --- a/docs/src/tutorials/parallelized_gsa.md +++ b/docs/src/tutorials/parallelized_gsa.md @@ -65,7 +65,7 @@ scatter( For the Sobol method, we can similarly do: ```@example ode -m = gsa(f1, Sobol(), [[1, 5], [1, 5], [1, 5], [1, 5]], samples = 1000) +m = gsa(f1, Sobol(), [[1, 5], [1, 5], [1, 5], [1, 5]], samples = 1024) ``` ## Direct Use of Design Matrices @@ -76,10 +76,10 @@ we use [QuasiMonteCarlo.jl](https://docs.sciml.ai/QuasiMonteCarlo/stable/) to ge as follows: ```@example ode -samples = 500 +samples = 512 lb = [1.0, 1.0, 1.0, 1.0] ub = [5.0, 5.0, 5.0, 5.0] -sampler = SobolSample() +sampler = SobolSample(; R = QuasiMonteCarlo.OwenScramble(; base = 2, pad = 9, rng = _rng)) A, B = QuasiMonteCarlo.generate_design_matrices(samples, lb, ub, sampler) ``` diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index aaad11c8..2dd1b861 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -46,6 +46,10 @@ by dividing other terms in the variance decomposition by `` Var(Y) ``. - `:Jansen1999` - [M.J.W. Jansen, 1999, Analysis of variance designs for model output, Computer Physics Communi- cation, 117, 35–43.](https://www.sciencedirect.com/science/article/abs/pii/S0010465598001544) - `:Janon2014` - [Janon, A., Klein, T., Lagnoux, A., Nodet, M., & Prieur, C. (2014). Asymptotic normality and efficiency of two Sobol index estimators. ESAIM: Probability and Statistics, 18, 342-364.](https://arxiv.org/abs/1303.6451) +!!! note + + Sobol sampling should be done with $2^k$ points and randomization, take a look at the docs for [QuasiMonteCarlo](https://docs.sciml.ai/QuasiMonteCarlo/stable/randomization/). If the number of samples is not a power of 2, the number of sample points will be changed to the next power of 2. + ### Example ```julia @@ -57,7 +61,7 @@ function ishi(X) sin(X[1]) + A*sin(X[2])^2+ B*X[3]^4 *sin(X[1]) end -samples = 600000 +samples = 524288 lb = -ones(4)*π ub = ones(4)*π sampler = SobolSample() diff --git a/test/sobol_method.jl b/test/sobol_method.jl index 764c594a..bf090ee2 100644 --- a/test/sobol_method.jl +++ b/test/sobol_method.jl @@ -22,7 +22,7 @@ function linear(X) A * X[1] + B * X[2] end -n = 600000 +n = 524288 lb = -ones(4) * π ub = ones(4) * π sampler = SobolSample() @@ -94,7 +94,7 @@ ishigami.fun <- function(X) { B <- 0.1 A * X[, 1] + B * X[, 2] } -n <- 6000000 +n <- 524288 X1 <- data.frame(matrix(runif(4 * n,-pi,pi), nrow = n)) X2 <- data.frame(matrix(runif(4 * n,-pi,pi), nrow = n)) sobol2007(ishigami.fun, X1, X2) From facbac813800ef56d4a247d312d6663c9c188a53 Mon Sep 17 00:00:00 2001 From: Vaibhav Dixit Date: Wed, 29 May 2024 21:15:22 -0400 Subject: [PATCH 10/12] sobol test value update --- test/sobol_method.jl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/sobol_method.jl b/test/sobol_method.jl index bf090ee2..ab19daaa 100644 --- a/test/sobol_method.jl +++ b/test/sobol_method.jl @@ -48,10 +48,7 @@ res1 = gsa(ishi, Sobol(order = [0, 1, 2], nboot = 20), A, B) 0.0 0.0 4.279200031668718e-5 1.2542212940962112e-5; 0.0 0.0 0.0 -7.998213172266514e-7; 0.0 0.0 0.0 0.0] atol=1e-4 @test res1.S1_Conf_Int≈[ - 0.00013100970128286063, - 0.00014730548523359544, - 7.398816006175431e-5, - 0.0 + 0.00018057916212640867, 0.0002327582551601999, 9.116874912775071e-5, 0.0 ] atol=1e-4 @test res1.ST_Conf_Int≈[ 5.657364947147881e-5, From 3b7cf9964824c6f07cc8198155ab8ccbea26f4fa Mon Sep 17 00:00:00 2001 From: Vaibhav Dixit Date: Wed, 29 May 2024 21:32:27 -0400 Subject: [PATCH 11/12] missed updates --- src/sobol_sensitivity.jl | 6 +++--- test/sobol_method.jl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sobol_sensitivity.jl b/src/sobol_sensitivity.jl index 2dd1b861..6fec58d7 100644 --- a/src/sobol_sensitivity.jl +++ b/src/sobol_sensitivity.jl @@ -47,13 +47,13 @@ by dividing other terms in the variance decomposition by `` Var(Y) ``. - `:Janon2014` - [Janon, A., Klein, T., Lagnoux, A., Nodet, M., & Prieur, C. (2014). Asymptotic normality and efficiency of two Sobol index estimators. ESAIM: Probability and Statistics, 18, 342-364.](https://arxiv.org/abs/1303.6451) !!! note - + Sobol sampling should be done with $2^k$ points and randomization, take a look at the docs for [QuasiMonteCarlo](https://docs.sciml.ai/QuasiMonteCarlo/stable/randomization/). If the number of samples is not a power of 2, the number of sample points will be changed to the next power of 2. ### Example ```julia -using GlobalSensitivity, QuasiMonteCarlo +using GlobalSensitivity, QuasiMonteCarlo, Random function ishi(X) A= 7 @@ -64,7 +64,7 @@ end samples = 524288 lb = -ones(4)*π ub = ones(4)*π -sampler = SobolSample() +sampler = SobolSample(; R = QuasiMonteCarlo.OwenScramble(; base = 2, pad = 19, rng = Random.default_rng())) A,B = QuasiMonteCarlo.generate_design_matrices(samples,lb,ub,sampler) res1 = gsa(ishi,Sobol(order=[0,1,2]),A,B) diff --git a/test/sobol_method.jl b/test/sobol_method.jl index ab19daaa..37a5062b 100644 --- a/test/sobol_method.jl +++ b/test/sobol_method.jl @@ -1,4 +1,4 @@ -using GlobalSensitivity, QuasiMonteCarlo, Test, OrdinaryDiffEq +using GlobalSensitivity, QuasiMonteCarlo, Test, OrdinaryDiffEq, Random function ishi_batch(X) A = 7 @@ -25,7 +25,7 @@ end n = 524288 lb = -ones(4) * π ub = ones(4) * π -sampler = SobolSample() +sampler = SobolSample(; R = QuasiMonteCarlo.OwenScramble(; base = 2, pad = 19, rng = Random.default_rng())) A, B = QuasiMonteCarlo.generate_design_matrices(n, lb, ub, sampler) res1 = gsa(ishi, Sobol(order = [0, 1, 2]), A, B) From 73c74ebcc07000cb3d5b55b2ee663a46011406ac Mon Sep 17 00:00:00 2001 From: Vaibhav Kumar Dixit Date: Wed, 29 May 2024 22:38:01 -0400 Subject: [PATCH 12/12] Update src/shapley_sensitivity.jl --- src/shapley_sensitivity.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/shapley_sensitivity.jl b/src/shapley_sensitivity.jl index f10f1914..b9c09879 100644 --- a/src/shapley_sensitivity.jl +++ b/src/shapley_sensitivity.jl @@ -208,7 +208,6 @@ function gsa(f, method::Shapley, input_distribution::SklarDist; batch = false) sample_complement, (1, length(sample_complement))) end - for l in 1:n_outer curr_sample = @view sample_complement[:, l] # Sampling of the set conditionally to the complementary element