FriesischScott / UncertaintyQuantification.jl

Uncertainty Quantification in Julia
MIT License
28 stars 7 forks source link

Sobol indices and QMC #49

Closed FriesischScott closed 2 years ago

FriesischScott commented 2 years ago

Using QMC to compute sobol indices yields very different results based on the method.

using UncertaintyQuantification

a = Parameter(7, :a)
b = Parameter(0.1, :b)

x = RandomVariable.(Uniform(-π, π), [:x1, :x2, :x3])

inputs = [a, b, x...]

ishigami = Model(
    df -> sin.(df.x1) + df.a .* sin.(df.x2) .^ 2 + df.b .* df.x3 .^ 4 .* sin.(df.x1),
    :f,
)

n = 10000

s_mc = sobolindices([ishigami], inputs, :f, MonteCarlo(n))
s_ss = sobolindices([ishigami], inputs, :f, SobolSampling(n))
s_hs = sobolindices([ishigami], inputs, :f, HaltonSampling(n))
s_lhs = sobolindices([ishigami], inputs, :f, LatinHypercubeSampling(n))

Just comparing the first order indices:

Monte Carlo and LatinHypercube are able to appoximate the analytical solution while Sobol and Halton are nowhere close.

Since LatinHyperCube, Sobol and Halton all go through the same sampling code, it can't be an issue there.

@AnderGray Any idea? I'm at a loss here.