Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaibhavdixit02 committed May 30, 2024
1 parent d060c3c commit b49608a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ KernelDensity = "0.6.4"
LinearAlgebra = "1.10"
OrdinaryDiffEq = "6.62"
Parameters = "0.12"
QuasiMonteCarlo = "0.3"
QuasiMonteCarlo = "0.3.0"
Random = "1.10"
RecursiveArrayTools = "3.2"
SafeTestsets = "0.1"
Expand Down
8 changes: 4 additions & 4 deletions docs/src/tutorials/shapley.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
)
```

Expand Down Expand Up @@ -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))
)
)
```
3 changes: 2 additions & 1 deletion src/shapley_sensitivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/sobol_sensitivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]))
Expand Down

0 comments on commit b49608a

Please sign in to comment.