-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from lanl/lauren_branch
Added new ModelF for bigger data and added some more examples/tutorials
- Loading branch information
Showing
7 changed files
with
2,908 additions
and
48 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "73a88bcb-ffcb-4b96-90e4-b8422c627f3c", | ||
"metadata": {}, | ||
"source": [ | ||
"# An Overview of IMPALA Workflow and Options\n", | ||
"In this document, we provide a non-exhaustive list of the functionality and user options for IMPALA. Generally, IMPALA provides a codebase for calibrating computer model outputs/simulations to observed data. \n", | ||
"\n", | ||
"Estimation uses Bayesian Markov Chain Monte Carlo, which has been implemented using a sophisticated sampling method called parallel tempering. The parallel tempering sampling allows IMPALA to navigate very complicated posterior surfaces (see Friedman example), including surfaces with multiple local modes and/or non-identified parameters. \n", | ||
"\n", | ||
"IMPALA calibration analyses generally proceed through several basic steps:\n", | ||
"\n", | ||
"### Specify Simulator\n", | ||
"\n", | ||
"1. If the computer model you want to calibrate is fast to run, define a function f(theta; X) that takes calibration parameter theta as an input and spits out the computer model output\n", | ||
"\n", | ||
"2. If the computer model is slow to run, generate a library of simulator runs and fit an emulator, which takes theta as an input and spits out an approximation of the true computer model output\n", | ||
"\n", | ||
"3. IMPALA has several material strength models already defined (e.g., Preston-Tonks-Wallace and Johnson-Cook). Check the impala/physics folder for pre-defined material strength models already available in IMPALA. \n", | ||
"\n", | ||
"### Initialize Impala Model\n", | ||
"\n", | ||
"1. ModelMaterialStrength: class for pre-defined IMPALA material strength models\n", | ||
"\n", | ||
"2. ModelBassPca_func or ModelBassPca_mult: classes for functional or multivariate emulators fit using the pyBASS library\n", | ||
" \n", | ||
"3. ModelF: class for user-defined functions f(x), which can also be used to implement IMPALA with non-BASS emulators\n", | ||
"\n", | ||
"### Prepare the Fit\n", | ||
"\n", | ||
"1. CalibSetup: initializes an IMPALA calibration object. This is also where you specify parameter bounds and any constraints\n", | ||
"\n", | ||
"2. addVecExperiments: define the observed data, corresponding computer model, discrepancy basis (if any), and several noise model prior hyperparameters. Multiple addVecExperiments calls can be used to add different experiments, possibly with different corresponding computer models. Some inputs include:\n", | ||
" * yobs: a vector (numpy array) of observed data\n", | ||
" * model: an IMPALA model object as defined above. See code documentation for details. \n", | ||
" * sd_est: a list or numpy array of initial values for observation noise standard deviation\n", | ||
" * s2_df: a list or numpy array of initial values for s2 Inverse Gamma prior degrees of freedom\n", | ||
" * s2_ind: a list or numpy array of indices for s2 value associated with each element of yobs\n", | ||
" * meas_error_cor: (optional) correlation matrix for observation measurement errors, default = independent \n", | ||
" * D: (optional) numpy array containing basis functions for discrepancy, possibly including intercept.\n", | ||
" * discrep_tau: (optional) fixed prior variance for discrepancy basis coefficients (discrepancy = D @ discrep_vars, \n", | ||
" * discrep_vars ~ N(0,discrep_tau))\n", | ||
"\n", | ||
"3. setTemperatureLadder: define how the parallel tempering should be implemented, requiring users to specify an array of exponents that will be applied to the data likelihood. An example specifcation is np.array(1.05 ** np.linspace(0,49,50)), which assigns a grid of 50 temperatures. Generally, more temperatures or a finer grid of temperatures are associated with longer runtime but may also be associated with better movement around the posterior surface for complicated posteriors. \n", | ||
"\n", | ||
"4. setMCMC: define how many MCMC iterations to use for the sampler. Most users can leave these settings at default values, with the expection of nmcmc (the number of iterations), which must be specified. \n", | ||
"\n", | ||
"5. setHierPriors: (optional) define hyperparameteters associated with the hierarchical and clustering calibrations. These generally control the amount of shrinkage toward a common theta across experiments. Please refer to the code documnetation for details. \n", | ||
"\n", | ||
"6. setClusterPriors: (optional) define hyperparameteters associated with the clustering calibration, including the maximum number of clusters (nclustmax) and the rate and shape associated with the Gamma prior on the Dirichlet process concentration parameter, eta. \n", | ||
"\n", | ||
"### Run MCMC\n", | ||
"\n", | ||
"1. calibPool: pooled calibration\n", | ||
"\n", | ||
"2. calibHier: hierarchical calibration\n", | ||
"\n", | ||
"3. calibClust: clustered calibration\n", | ||
"\n", | ||
"### Evaluate Convergence\n", | ||
"\n", | ||
"1. Look at trace plots, e.g., using parameter_trace_plot function\n", | ||
"\n", | ||
"2. Look at pairs plots, e.g., using pairs function\n", | ||
"\n", | ||
"3. There are many more convergence diagnostics you can explore. In the future, additional convergence evaluation functions will be added to the IMPALA repo. \n", | ||
"\n", | ||
"### Evaluate Model Fit\n", | ||
"\n", | ||
"1. Posterior predictions can be compared with the training data to evaluate goodness of fit of the calibrated computer model. See the examples elsewhere in the IMPALA repo for code. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "5678f566", | ||
"metadata": {}, | ||
"source": [ | ||
"# Summary\n", | ||
"The following figure summarizes the usual IMPALA fitting workflow: \n", | ||
"\n", | ||
"![something](./images/Impala_Diagram.png)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters