FriesischScott/UncertaintyQuantification.jl

SubsetSimulation errors with low number of samples

FriesischScott opened this issue · 1 comments

Thanks to @AnderGray for finding this bug. If less than 2 Markov chains move before the extra rejection step, the reject variable is not a vector and can not be used for indexing. Can be reproduced as follows.

using UncertaintyQuantification

Num_dim = 2
N_samples = 20

inputs = RandomVariable.(Normal(), [Symbol("X$d") for d in 1:Num_dim])

y = Model(df -> sum.(eachrow(df[:, names(inputs)])), :y)

pf_target = 10^-3

fail_limit = quantile(Normal(0, sqrt(Num_dim)), 1 - pf_target)

function limitstate(df)
    return fail_limit .- reduce(vcat, df.y)
end

simulation_method_1 = SubSetSimulation(N_samples, 0.1, 20, Uniform(-0.5, 0.5))

pf_1, std_1, _ = probability_of_failure(y, limitstate, inputs, simulation_method_1)

#138 may also not be entirely fixed.