$extrastylesheet
Dakota
Version 6.2
|
Interpolation method for interpolating between experimental and model data. I need to work on inputs/outputs to this method. For now, this assumes interpolation of functional data. More...
Public Member Functions | |
ExperimentData () | |
default constructor | |
ExperimentData (const ProblemDescDB &prob_desc_db, const SharedResponseData &srd, short output_level) | |
typical DB-based constructor | |
ExperimentData (size_t num_experiments, size_t num_config_vars, const boost::filesystem::path &data_prefix, const SharedResponseData &srd, const StringArray &variance_types, short output_level, std::string scalarDataFilename="") | |
temporary? constructor for testing | |
void | load_data (const std::string &context_message, bool calc_sigma_from_data) |
Load experiments from data files (simple scalar or field) | |
size_t | num_experiments () const |
retrieve the number of experiments | |
size_t | num_total_exppoints () const |
retrieve the total number of experimental data points over all experiments | |
size_t | num_scalars () const |
retrieve the number of scalars (applies to all experiments) | |
size_t | num_fields () const |
retrieve the number of fields (applies to all experiments) | |
const RealVector & | config_vars (size_t experiment) |
retrieve the vector of configuration variables for the given experiment number | |
const RealVector & | all_data (size_t experiment) |
return contiguous vector of all data (scalar, followed by field) for the specified experiment | |
void | per_exp_length (IntVector &per_length) const |
return the individual sizes of the experimental data lengths (all function values, scalar and field) | |
const IntVector & | field_lengths (size_t experiment) const |
return the field lengths for specified experiment index | |
Real | scalar_data (size_t response, size_t experiment) |
retrieve the data value for the given response, for the given experiment | |
Real | scalar_sigma_est (size_t response) |
retrieve the standard deviation value for the given response, estimated over all responses | |
RealVector | field_data_view (size_t response, size_t experiment) |
retrieve a view of the field data for the given response, for the given experiment | |
RealMatrix | field_coords_view (size_t response, size_t experiment) |
retrieve a view of the field data coordinates for the given response, for the given experiment | |
bool | variance_type_active (short variance_type) |
whether the specified variance type (enum value) is present and active | |
bool | variance_active () |
whether any variance type is active | |
Real | apply_covariance (const RealVector &residuals, size_t experiment) |
apply the covariance responses to compute the triple product v'*inv(C)*v for the given experiment | |
void | apply_covariance_inv_sqrt (const RealVector &residuals, size_t experiment, RealVector &weighted_residuals) |
apply inverse sqrt of the covariance to compute weighted residuals | |
void | apply_covariance_inv_sqrt (const RealMatrix &gradients, size_t experiment, RealMatrix &weighted_gradients) |
apply inverse sqrt of the covariance to compute weighted gradients | |
void | apply_covariance_inv_sqrt (const RealSymMatrixArray &hessians, size_t experiment, RealSymMatrixArray &weighted_hessians) |
apply inverse sqrt of the covariance to compute weighted Hessians | |
void | get_main_diagonal (RealVector &diagonal, size_t experiment) const |
return a (copy) vector containing the main diagonal entries of a specified experimental covariance matrix | |
void | form_residuals (const Response &sim_resp, const ShortArray &total_asv, Response &residual_resp) |
form residuals for all experiments, interpolating if necessary | |
void | form_residuals (const Response &sim_resp, size_t exp_num, const ShortArray &total_asv, size_t residual_resp_offset, Response &residual_resp) |
form residuals for an individual experiment, interpolating if necessary | |
void | form_residuals_deprecated (const Response &sim_resp, size_t experiment, RealVector &residuals) |
Remove once BAYES classes are cleaned up to use new Minimizer::data_difference_core functions. | |
void | recover_model (size_t num_pri_fns, RealVector &model_fns) const |
recover original model from the first experiment block in a full set of residuals; works in no interpolation case only (sizes same) | |
bool | interpolate_flag () |
flag for interpolation. If 0, no interpolation. If 1, interpolate. | |
void | interpolate_simulation_data (const Response &sim_resp, size_t exp_num, const ShortArray &total_asv, size_t exp_offset, Response &interp_resp) |
Interpolate simulation data (values, gradients and hessians) onto the coordinates of the experimental data. | |
ShortArray | determine_active_request (const Response &resid_resp, bool interogate_field_data) |
Perform check on the active request vector to make sure it is amenable to interpolation of simulation data and application of apply covariance. | |
void | scale_residuals (Response &residual_response, ShortArray &total_asv) |
Apply the experiment data covariance to the residual data. | |
void | build_hessian_of_sum_square_residuals (const Response &resp, RealSymMatrix &ssr_hessian) |
Build the hessian of the ssr from residuals, function gradients and function hessians based on the response's active set request vector. | |
void | build_hessian_of_sum_square_residuals (const Response &resp, const ShortArray &asrv, RealSymMatrix &ssr_hessian) |
Build the hessian of the ssr from residuals, function gradients and function hessians using the passed active set request vector (overrides the response's request vector) | |
void | build_hessian_of_sum_square_residuals_from_response (const Response &resp, const ShortArray &asrv, int exp_ind, RealSymMatrix &ssr_hessian) |
Update the hessian of ssr with the values from the hessian associated with a single experiment. | |
void | build_hessian_of_sum_square_residuals_from_function_data (const RealSymMatrixArray &func_hessians, const RealMatrix &func_gradients, const RealVector &residuals, RealSymMatrix &ssr_hessian, const ShortArray &asrv) |
Construct the hessian of the sum of squares of residuals. | |
Private Member Functions | |
void | initialize (const StringArray &variance_types, const SharedResponseData &srd) |
shared body of constructor initialization | |
void | parse_sigma_types (const StringArray &sigma_types) |
parse user-provided sigma type strings and populate enums | |
void | load_experiment (size_t exp_index, std::ifstream &scalar_data_stream, size_t num_field_sigma_matrices, size_t num_field_sigma_diagonals, size_t num_field_sigma_scalars, size_t num_field_sigma_none, Response &exp_resp) |
Load a single experiment exp_index into exp_resp. | |
void | read_scalar_sigma (std::ifstream &scalar_data_stream, RealVector &sigma_scalars, IntVector &scalar_map_indices) |
read or default populate the scalar sigma | |
RealVector | residuals_view (const RealVector &residuals, size_t experiment) |
Return a view (to allowing updaing in place) of the residuals associated with a given experiment, from a vector contaning residuals from all experiments. | |
RealMatrix | gradients_view (const RealMatrix &gradients, size_t experiment) |
Return a view (to allowing updaing in place) of the gradients associated with a given experiment, from a matrix contaning gradients from all experiments. | |
RealSymMatrixArray | hessians_view (const RealSymMatrixArray &hessians, size_t experiment) |
Return a view (to allowing updaing in place) of the hessians associated with a given experiment, from an array contaning the hessians from all experiments. | |
Private Attributes | |
bool | calibrationDataFlag |
whether the user specified a calibration data block | |
size_t | numExperiments |
the total number of experiments | |
size_t | numConfigVars |
number of configuration (state) variables to read for each experiment | |
UShortArray | varianceTypes |
type of variance specified for each variable, one per response group; empty varianceType indicates none specified by user | |
boost::filesystem::path | dataPathPrefix |
path to prepend to any data file names | |
String | scalarDataFilename |
the user-specied scalar data filename | |
unsigned short | scalarDataFormat |
tabular format of the simple scalar data file; supports TABULAR_NONE, TABULAR_HEADER, TABULAR_EVAL_ID, TABULAR_EXPER_ANNOT | |
size_t | scalarSigmaPerRow |
number of sigma values to read from each row in simple data file format (calculated from variance types strings | |
bool | readFieldCoords |
whether to read coordinate data files for fields | |
SharedResponseData | simulationSRD |
archived shared data for use in sizing fields, total functions (historically we read all functions, including constraints, which might not be correct) | |
bool | interpolateFlag |
flag for interpolation. | |
short | outputLevel |
output verbosity level | |
RealVector | estimated_sigmas |
vector of estimated sigma values to be used in Bayesian calibration | |
std::vector< Response > | allExperiments |
Vector of numExperiments ExperimentResponses, holding the observed data and error (sigma/covariance) for each experiment. | |
std::vector< RealVector > | allConfigVars |
Vector of numExperiments configurations at which data were gathered; empty if no configurations specified. | |
IntVector | experimentLengths |
Length of each experiment. | |
IntVector | expOffsets |
function index offsets for individual experiment data sets |
Interpolation method for interpolating between experimental and model data. I need to work on inputs/outputs to this method. For now, this assumes interpolation of functional data.
As Brian suggested, thsi class has the experimental data (coordinates and RealVectorArray interpolatedResults; The ExperimentData class is used to read and populate data (currently from user-specified files and/or the input spec) relating to experimental (physical observations) data for the purposes of calibration. Such data may include (for example): number of experiments, configuration variables, type of data (scalar vs. functional), treatment of sigma (experimental uncertainties). This class also provides an interpolation capability to interpolate between simulation or experimental data so that the differencing between simulation and experimental data may be performed properly.
void recover_model | ( | size_t | num_pri_fns, |
RealVector & | best_fns | ||
) | const |
recover original model from the first experiment block in a full set of residuals; works in no interpolation case only (sizes same)
Add the data back to the residual to recover the model, for use in surrogated-based LSQ where DB lookup will fail (need approx eval DB). best_fns contains primary and secondary responses
References Dakota::abort_handler(), ExperimentData::allExperiments, Response::function_value(), ExperimentData::interpolateFlag, and Response::num_functions().
Referenced by LeastSq::post_run().
void build_hessian_of_sum_square_residuals_from_function_data | ( | const RealSymMatrixArray & | func_hessians, |
const RealMatrix & | func_gradients, | ||
const RealVector & | residuals, | ||
RealSymMatrix & | ssr_hessian, | ||
const ShortArray & | asrv | ||
) |
Construct the hessian of the sum of squares of residuals.
func_hessians | A list of matrices containing the Hessians of the function elements in the residual vector |
func_gradients | A matrix containing the gradients of the residual vector |
residuals | A vector of residuals (mismatch between experimental data and the corresponding function values |
asrv | The active set request vector |
Referenced by ExperimentData::build_hessian_of_sum_square_residuals_from_response().
void parse_sigma_types | ( | const StringArray & | sigma_types | ) | [private] |
parse user-provided sigma type strings and populate enums
Validate user-provided sigma specifcation. User can specify 0, 1, or num_response_groups sigmas. If specified, sigma types must be the same for all scalar responses.
References Dakota::abort_handler(), SharedResponseData::num_response_groups(), SharedResponseData::num_scalar_responses(), ExperimentData::scalarDataFilename, ExperimentData::scalarSigmaPerRow, ExperimentData::simulationSRD, and ExperimentData::varianceTypes.
Referenced by ExperimentData::initialize().
void load_experiment | ( | size_t | exp_index, |
std::ifstream & | scalar_data_stream, | ||
size_t | num_field_sigma_matrices, | ||
size_t | num_field_sigma_diagonals, | ||
size_t | num_field_sigma_scalars, | ||
size_t | num_field_sigma_none, | ||
Response & | exp_resp | ||
) | [private] |
Load a single experiment exp_index into exp_resp.
Load an experiment from a mixture of legacy format data and field data format files
References ExperimentData::dataPathPrefix, Response::field_coords(), Response::field_group_labels(), ExperimentData::field_lengths(), Response::field_lengths(), Response::field_values(), Response::function_labels(), Response::function_value(), SharedResponseData::num_field_response_groups(), ExperimentData::num_fields(), SharedResponseData::num_scalar_responses(), ExperimentData::num_scalars(), ExperimentData::read_scalar_sigma(), ExperimentData::scalarDataFilename, ExperimentData::scalarSigmaPerRow, Response::set_full_covariance(), ExperimentData::simulationSRD, and ExperimentData::varianceTypes.
Referenced by ExperimentData::load_data().