bayesvalidrox.surrogate_models.sequential_design.SequentialDesign

class bayesvalidrox.surrogate_models.sequential_design.SequentialDesign(meta_model, model, exp_design, engine, discrepancy, parallel=False, out_names=None)

Bases: object

Contains options for choosing the next training sample iteratively.

Parameters

meta_modelobj

A bvr.MetaModel object. If no MetaModel should be trained and used, set this to None.

modelobj

A model interface of type bvr.PyLinkForwardModel that can be run.

exp_designobj

The experimental design that will be used to sample from the input space.

engineobj

A (trained) bvr.Engine object.

discrepancyobj

A bvr.Discrepancy object that describes the model uncertainty, i.e. the diagonal entries of the variance matrix for a multivariate normal likelihood.

parallelbool, optional

Set to True if the evaluations should be done in parallel. The default is False.

out_nameslist, optional

The list of requested output keys to be used for the analysis. The default is None.

__init__(meta_model, model, exp_design, engine, discrepancy, parallel=False, out_names=None)

Methods

__init__(meta_model, model, exp_design, ...)

choose_next_sample([n_candidates, var])

Runs optimal sequential design.

dual_annealing(method, bounds, var, run_idx)

Exploration algorithm to find the optimum parameter space.

run_util_func(method, candidates, index[, ...])

Runs the utility function based on the given method.

tradeoff_weights(tradeoff_scheme, old_ed_x, ...)

Calculates weights for exploration scores based on the requested scheme: None, equal, epsilon-decreasing and adaptive.

util_alph_opt_design(candidates[, var])

Enriches the Experimental design with the requested alphabetic criterion based on exploring the space with number of sampling points.

util_bayesian_active_design(y_hat, std[, var])

Computes scores based on Bayesian active design criterion (var).

util_bayesian_design(x_can, x_mc[, var])

Computes scores based on Bayesian sequential design criterion (var).

util_var_based_design(x_can, index[, util_func])

Computes the exploitation scores based on: active learning MacKay(ALM) and active learning Cohn (ALC) Paper: Sequential Design with Mutual Information for Computer Experiments (MICE): Emulation of a Tsunami Model by Beck and Guillas (2016)

choose_next_sample(n_candidates=5, var='DKL')

Runs optimal sequential design.

Parameters

n_candidatesint, optional

Number of candidate samples. The default is 5.

varstring, optional

Utility function. The default is ‘DKL’.

Raises

NameError

Wrong utility function.

Returns

Xnewarray (n_samples, n_params)

Selected new training point(s).

dual_annealing(method, bounds, var, run_idx, verbose=False)

Exploration algorithm to find the optimum parameter space.

Parameters

methodstring

Exploitation method: VarOptDesign, BayesActDesign and BayesOptDesign.

boundslist of tuples

List of lower and upper boundaries of parameters.

var : unknown run_idx : int

Run number.

verbosebool, optional

Print out a summary. The default is False.

Returns

run_idxint

Run number.

array

Optimial candidate.

run_util_func(method, candidates, index, var=None, x_mc=None)

Runs the utility function based on the given method.

Parameters

methodstring

Exploitation method: VarOptDesign, BayesActDesign and BayesOptDesign.

candidatesarray of shape (n_samples, n_params)

All candidate parameter sets.

indexint

exp_design index.

varstring, optional

Utility function. The default is None.

x_mcarray, optional

Monte-Carlo samples. The default is None.

Returns

indexTYPE

DESCRIPTION.

List

Scores.

tradeoff_weights(tradeoff_scheme, old_ed_x, old_ed_y)

Calculates weights for exploration scores based on the requested scheme: None, equal, epsilon-decreasing and adaptive.

None: No exploration. equal: Same weights for exploration and exploitation scores. epsilon-decreasing: Start with more exploration and increase the

influence of exploitation along the way with an exponential decay function

adaptive: An adaptive method based on:

Liu, Haitao, Jianfei Cai, and Yew-Soon Ong. “An adaptive sampling approach for Kriging metamodeling by maximizing expected prediction error.” Computers & Chemical Engineering 106 (2017): 171-182.

Parameters

tradeoff_schemestring

Trade-off scheme for exloration and exploitation scores.

old_ed_xarray (n_samples, n_params)

Old experimental design (training points).

old_ed_ydict

Old model responses (targets).

Returns

exploration_weightfloat

Exploration weight.

exploitation_weight: float

Exploitation weight.

util_alph_opt_design(candidates, var='D-Opt')

Enriches the Experimental design with the requested alphabetic criterion based on exploring the space with number of sampling points.

Ref: Hadigol, M., & Doostan, A. (2018). Least squares polynomial chaos expansion: A review of sampling strategies., Computer Methods in Applied Mechanics and Engineering, 332, 382-407.

Arguments

candidatesint?

Number of candidate points to be searched

varstring

Alphabetic optimality criterion

Returns

X_newarray of shape (1, n_params)

The new sampling location in the input space.

util_bayesian_active_design(y_hat, std, var='DKL')

Computes scores based on Bayesian active design criterion (var).

It is based on the following paper: Oladyshkin, Sergey, Farid Mohammadi, Ilja Kroeker, and Wolfgang Nowak. “Bayesian3 active learning for the gaussian process emulator using information theory.” Entropy 22, no. 8 (2020): 890.

Parameters

y_hat : unknown std : unknown var : string, optional

BAL design criterion. The default is ‘DKL’.

Returns

float

Score.

util_bayesian_design(x_can, x_mc, var='DKL')

Computes scores based on Bayesian sequential design criterion (var).

Parameters

x_canarray of shape (n_samples, n_params)

Candidate samples.

x_mcarray

Monte carlo samples

varstring, optional

Bayesian design criterion. The default is ‘DKL’.

Returns

float

Score.

util_var_based_design(x_can, index, util_func='Entropy')

Computes the exploitation scores based on: active learning MacKay(ALM) and active learning Cohn (ALC) Paper: Sequential Design with Mutual Information for Computer Experiments (MICE): Emulation of a Tsunami Model by Beck and Guillas (2016)

Parameters

x_canarray of shape (n_samples, n_params)

Candidate samples.

indexint

Model output index.

util_funcstring, optional

Exploitation utility function. The default is ‘Entropy’.

Returns

float

Score.