Adaptive Importance Sampling (AIS)

Adaptive Importance Sampler.

Description

AIS is used for estimating small failure probabilities (PfP_f) using computationally expensive finite element models efficiently. When implemented correctly, AIS can result in 2-3 orders of magnitude reduction to the number of calls to the model when compared to crude Monte Carlo simulations. For example, if crude Monte Carlo requires 1e6 calls to the model to estimate PfP_f with a coefficient of variation (COV) of 10 percent, AIS could require only about 1e4 calls to the model for the same COV. AIS has two phases: (1) a learning phase where the AIS algorithm learns the importance distribution of input parameters likely to cause model failure; and (2) a sampling phase to sample from the learned importance distribution. The version of AIS proposed by Au and Beck (1999) is implemented in MOOSE with a slight modification. Instead of using kernel density to characterize the importance distribution, a Normal density is used due to its simplicity and robustness.

Brief algorithmic details

For learning the importance distribution of the input parameters, a Markov Chain Monte Carlo algorithm, specifically the Metropolis algorithm, is used. The user supplies a initial_values vector of input parameters that would result in a model failure. Then, a Markov Chain is initiated to sufficiently sample from the failure region. The Markov Chain operates in Standard Normal space where all the input parameters are transformed to have a Normal distribution with mean 0 and standard deviation 1. Centered around the current sample (x\mathbf{x}), a new sample (x\mathbf{x}^*) is proposed considering the proposal distribution to be Normal and an acceptance ratio is computed:

α=N(x)N(x) \alpha = \frac{N(\mathbf{x}^*)}{N(\mathbf{x})}(1)

where, N(.)N(.) is a standard Normal distribution. The proposed sample is then accepted with probability α\alpha. In this manner, sufficient samples are generated from the failure region.

Once enough samples that result in model failure have been simulated, an importance distribution is fit to these samples. A Normal distribution is fit to each input parameter independently and sampling from this importance distribution is made. The use of an independent Normal distribution is different from the work by Au and Beck (1999), who use a multi-dimensional kernel density distribution. However, experience suggests that a Normal distribution is more robust under a wide variety of cases. Once the samples from the importance distribution are obtained, equation (2) and equation (19) in Au and Beck (1999) can be used for estimating the PfP_f and COV, respectively. Figure Figure 1 presents a schematic of the AIS method.

Figure 1: Schematic of the AIS method

Interaction with the AdaptiveMonteCarloDecision class

The AIS algorithm has a proposal step and a decision-making step on whether or not to accept the proposed sample. While the AIS class proposes a new sample, the AdaptiveMonteCarloDecision class is used for decision-making. Please refer to AdaptiveMonteCarloDecision for more details.

Example Input Syntax

The input file for using the AIS algorithm is somewhat similar to the other sampler classes except for three differences. First, the Samplers block is presented below:

[Samplers]
  [sample]
    type = AdaptiveImportance
    distributions = 'mu1 mu2'
    proposal_std = '1.0 1.0'
    output_limit = 0.65
    num_samples_train = 30
    num_importance_sampling_steps = 30
    std_factor = 0.9
    initial_values = '-0.103 1.239'
    inputs_reporter = 'adaptive_MC/inputs'
    use_absolute_value = true
    seed = 1012
  []
[]
(contrib/moose/modules/stochastic_tools/test/tests/samplers/AdaptiveImportanceSampler/ais.i)

where, proposal_std are proposal standard deviations (in Standard Normal space) used during the learning phase, output_limit is the limiting value greater than which is characterized as model failure , num_samples_train is the number of samples to learn the importance distribution, num_importance_sampling_steps is the number of importance sampling steps (after the importance distribution has been trained), std_factor is the factor multiplied to the standard deviation of the importance samples while characterizing the importance distribution, use_absolute_value can be set to true when failure is defined as a non-exceedance rather than an exceedance. inputs_reporter and output_reporter are the reporter values which transfer information between the AIS sampler and the AdaptiveMonteCarloDecision reporter.

Second, the Reporters block is presented below with the AdaptiveMonteCarloDecision reporter:

[Reporters]
  [constant]
    type = StochasticReporter
  []
  [adaptive_MC]
    type = AdaptiveMonteCarloDecision
    output_value = constant/reporter_transfer:average:value
    inputs = 'inputs'
    sampler = sample
  []
  [ais_stats]
    type = AdaptiveImportanceStats
    output_value = constant/reporter_transfer:average:value
    sampler = sample
  []
[]
(contrib/moose/modules/stochastic_tools/test/tests/samplers/AdaptiveImportanceSampler/ais.i)

where, output reporter and the inputs reporter are both initialized.

Third, the Executioner block is presented below:

[Executioner]
  type = Transient
[]
(contrib/moose/modules/stochastic_tools/test/tests/samplers/AdaptiveImportanceSampler/ais.i)

where it is noticed that unlike some other sampler classes, the type is transient. The number of time steps is automatically determined based on num_samples_train and num_importance_sampling_steps.

Output format

The AIS sampler can output a csv or a json file. However, a json output is a preferred output format for post-processing sampler data from adaptive Monte Carlo algorithms. The json file consists of "inputs" and "output_required" corresponding to each "time_step". "inputs" are the uncertain input parameters to the model, "output_required" is an indicator function on whether or not the model output exceeded output_limit, and "time_step" is the sample index. The first num_samples_train time steps are the samples during the learning phase and should not be used for estimating the PfP_f or COV. The next num_steps - num_samples_train are the required importance samples used for estimating PfP_f or COV.

Failure probability and COV

Statistics such as the PfP_f and COV can be computed using the AdaptiveImportanceStats Reporter object.

Input Parameters

  • distributionsThe distribution names to be sampled, the number of distributions provided defines the number of columns per matrix.

    C++ Type:std::vector<DistributionName>

    Unit:(no unit assumed)

    Controllable:No

    Description:The distribution names to be sampled, the number of distributions provided defines the number of columns per matrix.

  • initial_valuesInitial input values to get the importance sampler started

    C++ Type:std::vector<double>

    Unit:(no unit assumed)

    Controllable:No

    Description:Initial input values to get the importance sampler started

  • inputs_reporterReporter with input parameters.

    C++ Type:ReporterName

    Unit:(no unit assumed)

    Controllable:No

    Description:Reporter with input parameters.

  • num_importance_sampling_stepsNumber of importance sampling steps (after the importance distribution has been trained)

    C++ Type:int

    Unit:(no unit assumed)

    Controllable:No

    Description:Number of importance sampling steps (after the importance distribution has been trained)

  • num_samples_trainNumber of samples to learn the importance distribution

    C++ Type:int

    Unit:(no unit assumed)

    Controllable:No

    Description:Number of samples to learn the importance distribution

  • output_limitLimiting values of the VPPs

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Limiting values of the VPPs

  • proposal_stdStandard deviations of the proposal distributions

    C++ Type:std::vector<double>

    Unit:(no unit assumed)

    Controllable:No

    Description:Standard deviations of the proposal distributions

  • std_factorFactor to be multiplied to the standard deviation of the importance samples

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Factor to be multiplied to the standard deviation of the importance samples

Required Parameters

  • execute_onLINEARThe list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html.

    Default:LINEAR

    C++ Type:ExecFlagEnum

    Unit:(no unit assumed)

    Options:NONE, INITIAL, LINEAR, NONLINEAR_CONVERGENCE, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, PRE_MULTIAPP_SETUP

    Controllable:No

    Description:The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html.

  • flag_sampleFlag samples if the surrogate prediction was inadequate.

    C++ Type:ReporterName

    Unit:(no unit assumed)

    Controllable:No

    Description:Flag samples if the surrogate prediction was inadequate.

  • limit_get_global_samples429496729The maximum allowed number of items in the DenseMatrix returned by getGlobalSamples method.

    Default:429496729

    C++ Type:unsigned long

    Unit:(no unit assumed)

    Controllable:No

    Description:The maximum allowed number of items in the DenseMatrix returned by getGlobalSamples method.

  • limit_get_local_samples429496729The maximum allowed number of items in the DenseMatrix returned by getLocalSamples method.

    Default:429496729

    C++ Type:unsigned long

    Unit:(no unit assumed)

    Controllable:No

    Description:The maximum allowed number of items in the DenseMatrix returned by getLocalSamples method.

  • limit_get_next_local_row429496729The maximum allowed number of items in the std::vector returned by getNextLocalRow method.

    Default:429496729

    C++ Type:unsigned long

    Unit:(no unit assumed)

    Controllable:No

    Description:The maximum allowed number of items in the std::vector returned by getNextLocalRow method.

  • max_procs_per_row4294967295This will ensure that the sampler is partitioned properly when 'MultiApp/*/max_procs_per_app' is specified. It is not recommended to use otherwise.

    Default:4294967295

    C++ Type:unsigned int

    Unit:(no unit assumed)

    Controllable:No

    Description:This will ensure that the sampler is partitioned properly when 'MultiApp/*/max_procs_per_app' is specified. It is not recommended to use otherwise.

  • min_procs_per_row1This will ensure that the sampler is partitioned properly when 'MultiApp/*/min_procs_per_app' is specified. It is not recommended to use otherwise.

    Default:1

    C++ Type:unsigned int

    Unit:(no unit assumed)

    Controllable:No

    Description:This will ensure that the sampler is partitioned properly when 'MultiApp/*/min_procs_per_app' is specified. It is not recommended to use otherwise.

  • num_random_seeds100000Initialize a certain number of random seeds. Change from the default only if you have to.

    Default:100000

    C++ Type:unsigned int

    Unit:(no unit assumed)

    Controllable:No

    Description:Initialize a certain number of random seeds. Change from the default only if you have to.

  • seed0Random number generator initial seed

    Default:0

    C++ Type:unsigned int

    Unit:(no unit assumed)

    Controllable:No

    Description:Random number generator initial seed

  • use_absolute_valueFalseUse absolute value of the sub app output

    Default:False

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Use absolute value of the sub app output

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Unit:(no unit assumed)

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters

References

  1. S. K. Au and J. L. Beck. A new adaptive importance sampling scheme for reliability calculations. Structural safety, 21(2):135–158, 1999. URL: https://doi.org/10.1016/S0167-4730(99)00014-4.[BibTeX]