UQTk: Uncertainty Quantification Toolkit 3.1.5
inference.h File Reference

Header for the model inference tools. More...

#include <string>
#include "Array1D.h"
#include "Array2D.h"

Go to the source code of this file.

Functions

void infer_model (Array1D< Array2D< double >(*)(Array2D< double > &, Array2D< double > &, Array2D< double > &, void *) > forwardFuncs, void *funcInfo, string likType, string priorType, double priora, double priorb, Array2D< double > &xdata, Array1D< Array1D< double > > &ydata, Array2D< double > &xgrid, int dataNoiseInference, Array1D< double > &datanoise_array, int pdim, int order, Array1D< int > &rndInd, Array2D< double > &fixIndNom, string pdfType, string pcType, int seed, int nmcmc, double mcmcgamma, bool optimflag, Array1D< double > &chstart, Array1D< double > &chsig, double likParam, int likParam_int, Array2D< double > &pgrid, Array2D< double > &pchain, int nburn, int nstep, Array1D< double > &mapparam, Array1D< double > &datavar_map, Array1D< double > &pmean_map, Array1D< double > &pvar_map, Array1D< double > &fmean_map, Array1D< double > &fvar_map, Array1D< double > &postave_datavar, Array1D< double > &p_postave_mean, Array1D< double > &p_postave_var, Array1D< double > &p_postvar_mean, Array2D< double > &f_postsam_mean, Array1D< double > &f_postave_mean, Array1D< double > &f_postave_var, Array1D< double > &f_postvar_mean, Array2D< double > &paramPCcfs)
 Main function for inferring model parameters.
 
double LogPosterior (Array1D< double > &m, void *mypost_void)
 Log-posterior function given a vector of parameters (chain state) and a void* set of auxiliary variables.
 

Detailed Description

Header for the model inference tools.

Author
K. Sargsyan 2016 -

Function Documentation

◆ infer_model()

void infer_model ( Array1D< Array2D< double >(* forwardFuncs )(Array2D< double > &, Array2D< double > &, Array2D< double > &, void *) >,
void * funcInfo,
string likType,
string priorType,
double priora,
double priorb,
Array2D< double > & xdata,
Array1D< Array1D< double > > & ydata,
Array2D< double > & xgrid,
int dataNoiseInference,
Array1D< double > & datanoise_array,
int pdim,
int order,
Array1D< int > & rndInd,
Array2D< double > & fixIndNom,
string pdfType,
string pcType,
int seed,
int nmcmc,
double mcmcgamma,
bool optimflag,
Array1D< double > & chstart,
Array1D< double > & chsig,
double likParam,
int likParam_int,
Array2D< double > & pgrid,
Array2D< double > & pchain,
int nburn,
int nstep,
Array1D< double > & mapparam,
Array1D< double > & datavar_map,
Array1D< double > & pmean_map,
Array1D< double > & pvar_map,
Array1D< double > & fmean_map,
Array1D< double > & fvar_map,
Array1D< double > & postave_datavar,
Array1D< double > & p_postave_mean,
Array1D< double > & p_postave_var,
Array1D< double > & p_postvar_mean,
Array2D< double > & f_postsam_mean,
Array1D< double > & f_postave_mean,
Array1D< double > & f_postave_var,
Array1D< double > & f_postvar_mean,
Array2D< double > & paramPCcfs )

Main function for inferring model parameters.

Note
This is written in a fortran style, i.e. some arguments are inputs, and the rest are output
Parameters
[in]*forwardFuncs: an array of y=f(p,x) functions that take np-by-pdim and nx-by-xdim input arrays and returns an np-by-nx output, see tools/func.h for several examples
[in]funcinfo: auxiliary function-specific information (can be 0)
[in]likType: likelihood type: options are 'full', 'marg', 'mvn', 'gausmarg', 'abc', 'abcm', 'classical', 'koh' (see UQTk Manual)
[in]priorType: prior type: options are 'uniform', 'normal', 'inverse', etc ... (see UQTk Manual)
[in]priora,priorb: prior parameters (todo: need to be made dimension-specific) for uniform, it is the range, for normal it is the moments
[in]xdata: x-values of data, nx-by-xdim
[in]ydata: y-values of data, nx-by-neach
[in]xgrid: x-values where predictive moments are computed after the inference : can be the same as xdata
[in]dataNoiseInference: indicator, data noise stdev is fixed(0), inferred (1), or log-inferred (2)
[in]datanoise_array: data noise stdev array, if fixed, otherwise merely an MCMC starting point
[in]pdim: model parameter dimensionality
[in]order: order of output PC that is computed via NISP in the likelihood
[in]rndInd: array of indices of parameters to be randomized
[in]fixIndNom: array of indices and nominal values of parameters to be fixed
[in]pdfType: type of PDF PC parameterization, options are 'pct','pci' and 'full' (see UQTk Manual)
[in]pcType: type of PC for the PDF parameterization, options are all common PC types, e.g. 'HG','LU'
[in]seed: integer seed for MCMC
[in]nmcmc: number of MCMC steps to follow optimization; if 0, then only optimization is performed if optimflag is True
[in]mcmcgamma: gamma (scaling) parameter for adaptive MCMC
[in]optimflag: indicates if optimization is prepended to MCMC
[in]chstart: initial chain state
[in]chsig: initial non-adaptive, dimensionwise proposal jump size
[in]likParam,likParam_int: likelihood parameters (currently, only needed for KDE-based likelihoods, 'full' and 'marg', to pass the KDE bandwidth and number of samples)
[in]pgrid: parameter grid, if requested, to compute exact posterior (can be empty)
[in]nburn: burn-in for MCMC to write to pchain
[in]nstep: thinning of MCMC to write to pchain
[in,out]pchain: thinned chain file with nburn and nstep applied, to be used for postprocessing : if given as non-empty array, the MCMC is skipped, and only postprocessing is performed
[out]mapparam: MAP parameters
[out]datavar_map: MAP value of data variances
[out]pmean_map,pvar_map: MAP values of parameter means and variances
[out]fmean_map,fvar_map: MAP values of function predition (at xgrid) means and variances
[out]postave_datavar: posterior average of data variances
[out]p_postave_mean: posterior average of parameter mean
[out]p_postave_var: posterior average of parameter variance
[out]p_postvar_mean: posterior variance of parameter mean
[out]f_postave_mean: posterior average of function prediction mean
[out]f_postave_var: posterior average of function prediction variance
[out]f_postvar_mean: posterior variance of function prediction mean
[out]paramPCcfs: each column is a vector of parameter PC coefficients corresponding to an MCMC sample from pchain the last column is the MAP value of parameter PC coefficients

◆ LogPosterior()

double LogPosterior ( Array1D< double > & m,
void * mypost_void )

Log-posterior function given a vector of parameters (chain state) and a void* set of auxiliary variables.