bayesvalidrox.surrogate_models.sequential_design.SequentialDesign¶
- class bayesvalidrox.surrogate_models.sequential_design.SequentialDesign(meta_model, exp_design, discrepancy, observations=None, parallel=False, out_names=None, verbose=False)¶
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.
- 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.
- verbosebool, optional
Verbosity of the methods, the default is False.
- __init__(meta_model, exp_design, discrepancy, observations=None, parallel=False, out_names=None, verbose=False)¶
Methods
__init__
(meta_model, exp_design, discrepancy)Runs optimal sequential design.
dual_annealing
(exploit_method, bounds, run_idx)Exploration algorithm to find the optimum parameter space.
run_exploitation
(all_candidates)Run the selected exploitation 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
(all_candidates)Enriches the Experimental design with the requested alphabetic criterion based on exploring the space with number of sampling points.
util_bayesian_active_design
(x_can)Computes score based on Bayesian active design criterion (var).
util_var_opt_design
(x_can)Computes the exploitation scores based on:
- choose_next_sample()¶
Runs optimal sequential design.
Raises¶
- NameError
Wrong utility function.
Returns¶
- Xnewarray (n_samples, n_params)
Selected new training point(s).
- dual_annealing(exploit_method, bounds, run_idx, verbose=False)¶
Exploration algorithm to find the optimum parameter space.
Note: Currently does not support BayesActDesign due to possibility of inf/nan values.
Parameters¶
- exploit_methodstring
Exploitation method: VarOptDesign
- boundslist of tuples
List of lower and upper boundaries of parameters.
- run_idxint
Run number.
- verbosebool, optional
Print out a summary. The default is False.
Returns¶
- run_idxint
Run number.
- array
Optimial candidate.
- run_exploitation(all_candidates)¶
Run the selected exploitation method. Supports ‘bayesactdesign’, ‘varoptdesign’ and ‘alphabetic’.
Parameters¶
- all_candidatesnp.ndarray
Candidate samples.
Returns¶
- norm_score_exploitationnp.ndarray
Exploitation scores
- opt_typestr
Optimization type, either ‘minimization’ or ‘maximization’
- 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.
exploit_only: No exploration, full exploitation. explore_only: Full exploration, no exploitation. 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(all_candidates)¶
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¶
- all_candidatesarray
Array with candidate points to be searched
Returns¶
- scoresarray of shape (n_candidates,)
The scores for each candidate point based on the selected utility function.
- util_bayesian_active_design(x_can)¶
Computes score 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¶
- x_cannp.ndarray
A single candidate sample.
Returns¶
- float
Exploitation score for the candidate sample.
- util_var_opt_design(x_can)¶
Computes the exploitation scores based on:
- ALM (Active Learning MacKay):
Selects points where the surrogate model’s predictive variance is largest.
- EIGF (Expected Improvement for Global Fit):
Selects points where the prediction error (vs. nearest observed data) plus the variance is largest.
- MI (Mutual Information):
Selects points that maximize mutual information between the new sample and the unobserved.
- ALC (Active Learning Cohn):
Selects candidate points that minimize the average predictive variance across a set of Monte Carlo evaluation points.
The calculations are based on the following sources. ALM:
MacKay, D. J. (1992). Information-based objective functions for active data selection. Neural computation
- EIGF, MI, ALC:
Beck, J., & Guillas, S. (2016). Sequential design with mutual information for computer experiments (MICE): Emulation of a tsunami model. SIAM/ASA Journal on Uncertainty Quantification
Parameters¶
- x_canarray of shape (n_samples, n_params)
Candidate samples.
Returns¶
- float
Score.