Skip to content

Commit 2e51545

Browse files
authored
Document use of Distributions with eFAST (#163)
Documents the use of `Distributions` enabled by: #133
1 parent 58f0c5e commit 2e51545

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/eFAST_sensitivity.jl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,43 @@ For more details, on the transformation used and other implementation details yo
2222
distributed::Val{SHARED_ARRAY} = Val(false),
2323
rng::AbstractRNG = Random.default_rng(), kwargs...) where {SHARED_ARRAY}
2424
25+
Note, `p_range` is either a vector of tuples for the upper and lower bound or a vector of `Distribution`s.
2526
2627
### Example
2728
2829
Below we show use of `eFAST` on the Ishigami function.
2930
3031
```julia
31-
using GlobalSensitivity, QuasiMonteCarlo
32+
using GlobalSensitivity, QuasiMonteCarlo, Distributions
3233
3334
function ishi(X)
3435
A= 7
3536
B= 0.1
3637
sin(X[1]) + A*sin(X[2])^2+ B*X[3]^4 *sin(X[1])
3738
end
3839
40+
## define upper and lower limits, a.k.a uniform distributions
3941
lb = -ones(4)*π
4042
ub = ones(4)*π
4143
42-
res1 = gsa(ishi,eFAST(),[[lb[i],ub[i]] for i in 1:4],samples=15000)
44+
res1 = gsa(ishi, eFAST(), [[lb[i],ub[i]] for i in 1:4], samples=15000)
4345
44-
##with batching
46+
# define distributions for the inputs
47+
input_ranges = [Normal(0, 1),
48+
Uniform(-π, π),
49+
Uniform(-π, π),
50+
Uniform(-π, π)]
51+
52+
res2 = gsa(ishi, eFAST(), input_ranges, samples=15000)
53+
54+
## with batching
4555
function ishi_batch(X)
4656
A= 7
4757
B= 0.1
4858
@. sin(X[1,:]) + A*sin(X[2,:])^2+ B*X[3,:]^4 *sin(X[1,:])
4959
end
5060
51-
res2 = gsa(ishi_batch,eFAST(),[[lb[i],ub[i]] for i in 1:4],samples=15000,batch=true)
52-
61+
res3 = gsa(ishi_batch, eFAST(), [[lb[i],ub[i]] for i in 1:4], samples=15000, batch=true)
5362
```
5463
"""
5564
struct eFAST <: GSAMethod

0 commit comments

Comments
 (0)