Dakota
Version 6.21
Explore and Predict with Confidence
|
Class for a utility class containing correlation calculations and variance-based decomposition. More...
Public Member Functions | |
SensAnalysisGlobal () | |
constructor | |
~SensAnalysisGlobal () | |
destructor | |
void | compute_correlations (const VariablesArray &vars_samples, const IntResponseMap &resp_samples, const StringSetArray &dss_vals) |
computes four correlation matrices for input and output data simple, partial, simple rank, and partial rank More... | |
void | compute_correlations (const RealMatrix &vars_samples, const IntResponseMap &resp_samples) |
computes four correlation matrices for input and output data simple, partial, simple rank, and partial rank More... | |
void | archive_correlations (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const size_t &inc_id=0) const |
save correlations to database | |
void | archive_std_regress_coeffs (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const size_t &inc_id=0) const |
save standardized regression coefficients to database | |
bool | correlations_computed () const |
returns corrComputed to indicate whether compute_correlations() has been invoked | |
void | print_correlations (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels) const |
prints the correlations computed in compute_correlations() | |
void | compute_std_regress_coeffs (const RealMatrix &vars_samples, const IntResponseMap &resp_samples) |
computes standardized regression coefficients and corresponding R^2 values for input and output data | |
void | print_std_regress_coeffs (std::ostream &s, StringArray var_labels, const StringArray &resp_labels) const |
prints the SRCs and R^2 values computed in compute_correlations() | |
void | compute_vbd_stats_via_sampling (const unsigned short method, const int numBins, const size_t numFunctions, const size_t num_vars, const size_t num_samples, const RealMatrix &vars_samples, const IntResponseMap &resp_samples) |
compute VBD-based Sobol indices | |
void | print_sobol_indices (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels, const Real dropTol) const |
Printing of VBD results. | |
void | archive_sobol_indices (const StrStrSizet &run_identifier, ResultsManager &resultsDB, const StringArray &var_labels, const StringArray &resp_labels, const Real dropTol) const |
archive VBD-based Sobol indices | |
Protected Member Functions | |
void | compute_binned_sobol_indices_from_valid_samples (const RealMatrix &valid_samples, size_t num_bins) |
compute binned sobol indices from valid samples (having screened out samples with non-numeric response) | |
Protected Attributes | |
size_t | numFns |
Reorder. More... | |
size_t | numVars |
number of inputs | |
RealVectorArray | indexSi |
Matrix to hold binned Sobol' indices. More... | |
RealVectorArray | indexTi |
VBD total effect indices. | |
Private Member Functions | |
void | check_num_samples (const size_t num_var_samples, const size_t num_response_samples, const char *method_name) |
Checks there are a nonzero number of samples and that the number of samples agree between variables and responses. Method name passed for error handling. | |
size_t | get_n_vars (const VariablesArray &vars_samples) |
Computes the number of variables for a full variable object. | |
size_t | find_valid_samples (const IntResponseMap &resp_samples, BoolDeque &valid_sample) |
find samples with finite response (any sample with any Nan or +/-Inf observation will be dropped) | |
void | valid_sample_matrix (const VariablesArray &vars_samples, const IntResponseMap &resp_samples, const StringSetArray &dss_vals, const BoolDeque is_valid_sample, RealMatrix &valid_data) |
extract a compact valid sample (vars/resp) matrix from the passed data | |
void | valid_sample_matrix (const RealMatrix &vars_samples, const IntResponseMap &resp_samples, const BoolDeque is_valid_sample, RealMatrix &valid_samples) |
extract a compact valid sample (vars/resp) matrix from the passed data | |
void | values_to_ranks (RealMatrix &valid_data) |
replace sample values with their ranks, in-place More... | |
void | correl_adjust (Real &corr_value) |
if result was NaN/Inf, preserve it, otherwise truncate to [-1.0, 1.0] | |
void | simple_corr (RealMatrix &total_data, const int &num_in, RealMatrix &corr_matrix) |
computes simple correlations, populating corr_matrix More... | |
void | partial_corr (RealMatrix &total_data, const int num_in, const RealMatrix &simple_corr_mat, RealMatrix &corr_matrix, bool &numerical_issues) |
computes partial correlations, populating corr_matrix and numerical_issues More... | |
bool | has_nan_or_inf (const RealMatrix &corr) const |
Return true if there are any NaN or Inf entries in the matrix. | |
void | check_correlations_for_nan_or_inf (std::ostream &s) const |
Check correlation matrices for nans or infs and print warning message. | |
void | print_simple_correlations (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels, bool rank) const |
print simple (rank = false) or simple rank (rank = true) correlations | |
void | print_partial_correlations (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels, bool rank) const |
print partial (rank = false) or partial rank (rank = true) correlations | |
void | archive_simple_correlations (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const std::vector< const char * > &combined_desc, const size_t &inc_id, bool rank) const |
archive simple (rank = false) or simple rank (rank = true) correlations | |
void | archive_partial_correlations (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const size_t &inc_id, bool rank) const |
archive partial (rank = false) or partial rank (rank = true) correlations | |
void | compute_pick_and_freeze_vbd_stats (const size_t numFunctions, const size_t num_vars, const size_t num_samples, const IntResponseMap &resp_samples) |
void | compute_binned_vbd_stats (const int numBins, const size_t numFunctions, const size_t num_vars, const size_t num_samples, const RealMatrix &vars_samples, const IntResponseMap &resp_samples) |
IntMatrix | get_var_samples_argsort (const RealMatrix &valid_data) |
Returns a matrix where columns are the indices that would sort each variable's samples smallest to largest. | |
void | compute_response_means_and_variances (const RealMatrix &response_samples, RealVector &total_means, RealVector &total_variances) |
void | print_main_and_total_effects_indices (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels, const Real dropTol) const |
void | print_main_effects_indices (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels, const Real dropTol) const |
void | archive_main_effects_indices (const StrStrSizet &run_identifier, ResultsManager &resultsDB, const StringArray &var_labels, const StringArray &resp_labels, const Real dropTol) const |
archive VBD-based Sobol main effects indices | |
void | archive_total_effects_indices (const StrStrSizet &run_identifier, ResultsManager &resultsDB, const StringArray &var_labels, const StringArray &resp_labels, const Real dropTol) const |
archive VBD-based Sobol total effects indices | |
Static Private Member Functions | |
static bool | rank_sort (const int &x, const int &y) |
sort algorithm to compute ranks for rank correlations | |
Private Attributes | |
RealMatrix | simpleCorr |
matrix to hold simple raw correlations | |
RealMatrix | simpleRankCorr |
matrix to hold simple rank correlations | |
RealMatrix | partialCorr |
matrix to hold partial raw correlations | |
RealMatrix | partialRankCorr |
matrix to hold partial rank correlations | |
RealMatrix | stdRegressCoeffs |
matrix to hold standardized regression coefficients | |
RealVector | stdRegressCODs |
vector to hold coefficients of determination, eg R^2 values | |
bool | numericalIssuesRaw |
flag indicating numerical issues in partial raw correlation calculations | |
bool | numericalIssuesRank |
flag indicating numerical issues in partial rank correlation calculations | |
bool | corrComputed |
flag indicatng whether correlations have been computed | |
Static Private Attributes | |
static RealArray | rawData = RealArray() |
array to hold temporary data before sort | |
Class for a utility class containing correlation calculations and variance-based decomposition.
This class provides code for several of the sampling methods both in the NonD branch and in the PStudyDACE branch. Currently, the utility functions provide global sensitivity analysis through correlation calculations (e.g. simple, partial, rank, raw) as well as variance-based decomposition.
void compute_correlations | ( | const VariablesArray & | vars_samples, |
const IntResponseMap & | resp_samples, | ||
const StringSetArray & | dss_vals | ||
) |
computes four correlation matrices for input and output data simple, partial, simple rank, and partial rank
This version is used when full variables objects are being processed. Calculates simple correlation, partial correlation, simple rank correlation, and partial rank correlation coefficients.
References SensAnalysisGlobal::check_num_samples(), SensAnalysisGlobal::corrComputed, SensAnalysisGlobal::find_valid_samples(), SensAnalysisGlobal::get_n_vars(), SensAnalysisGlobal::numericalIssuesRank, SensAnalysisGlobal::numericalIssuesRaw, SensAnalysisGlobal::numFns, SensAnalysisGlobal::numVars, SensAnalysisGlobal::partial_corr(), SensAnalysisGlobal::partialCorr, SensAnalysisGlobal::partialRankCorr, SensAnalysisGlobal::simple_corr(), SensAnalysisGlobal::simpleCorr, SensAnalysisGlobal::simpleRankCorr, SensAnalysisGlobal::valid_sample_matrix(), and SensAnalysisGlobal::values_to_ranks().
Referenced by NonDSampling::compute_statistics(), DDACEDesignCompExp::post_run(), FSUDesignCompExp::post_run(), and ParamStudy::post_run().
void compute_correlations | ( | const RealMatrix & | vars_samples, |
const IntResponseMap & | resp_samples | ||
) |
computes four correlation matrices for input and output data simple, partial, simple rank, and partial rank
This version is used when compact samples matrix is being processed. Calculates simple correlation, partial correlation, simple rank correlation, and partial rank correlation coefficients.
References SensAnalysisGlobal::check_num_samples(), SensAnalysisGlobal::corrComputed, SensAnalysisGlobal::find_valid_samples(), SensAnalysisGlobal::numericalIssuesRank, SensAnalysisGlobal::numericalIssuesRaw, SensAnalysisGlobal::numFns, SensAnalysisGlobal::numVars, SensAnalysisGlobal::partial_corr(), SensAnalysisGlobal::partialCorr, SensAnalysisGlobal::partialRankCorr, SensAnalysisGlobal::simple_corr(), SensAnalysisGlobal::simpleCorr, SensAnalysisGlobal::simpleRankCorr, SensAnalysisGlobal::valid_sample_matrix(), and SensAnalysisGlobal::values_to_ranks().
|
private |
replace sample values with their ranks, in-place
When converting values to ranks, uses the average ranks of any tied values
Referenced by SensAnalysisGlobal::compute_correlations().
|
private |
computes simple correlations, populating corr_matrix
Calculates simple correlation coefficients from a matrix of data (oriented factors x observations):
References Dakota::center_matrix_rows(), and SensAnalysisGlobal::correl_adjust().
Referenced by SensAnalysisGlobal::compute_correlations().
|
private |
computes partial correlations, populating corr_matrix and numerical_issues
Calculates partial correlation coefficients between num_in inputs and numRows() - num_in outputs.
References Dakota::abort_handler(), Dakota::center_matrix_rows(), SensAnalysisGlobal::correl_adjust(), Dakota::qr(), Dakota::qr_rsolve(), and Dakota::singular_value_decomp().
Referenced by SensAnalysisGlobal::compute_correlations().
|
protected |
Reorder.
number of responses
Referenced by SensAnalysisGlobal::archive_partial_correlations(), SensAnalysisGlobal::archive_simple_correlations(), SensAnalysisGlobal::compute_binned_sobol_indices_from_valid_samples(), SensAnalysisGlobal::compute_correlations(), SensAnalysisGlobal::compute_std_regress_coeffs(), SensAnalysisGlobal::find_valid_samples(), SensAnalysisGlobal::print_correlations(), SensAnalysisGlobal::print_partial_correlations(), SensAnalysisGlobal::print_simple_correlations(), SensAnalysisGlobal::print_std_regress_coeffs(), and SensAnalysisGlobal::valid_sample_matrix().
|
protected |
Matrix to hold binned Sobol' indices.
VBD main effect indices
Referenced by SensAnalysisGlobal::archive_main_effects_indices(), and SensAnalysisGlobal::compute_binned_sobol_indices_from_valid_samples().