Dakota  Version 6.21
Explore and Predict with Confidence
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SensAnalysisGlobal Class Reference

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
 

Detailed Description

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.

Member Function Documentation

◆ compute_correlations() [1/2]

void compute_correlations ( const VariablesArray &  vars_samples,
const IntResponseMap &  resp_samples,
const StringSetArray &  dss_vals 
)

◆ compute_correlations() [2/2]

void compute_correlations ( const RealMatrix &  vars_samples,
const IntResponseMap &  resp_samples 
)

◆ values_to_ranks()

void values_to_ranks ( RealMatrix &  valid_data)
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().

◆ simple_corr()

void simple_corr ( RealMatrix &  total_data,
const int &  num_in,
RealMatrix &  corr_matrix 
)
private

computes simple correlations, populating corr_matrix

Calculates simple correlation coefficients from a matrix of data (oriented factors x observations):

  • num_corr is number of rows of total data
  • num_in indicates whether only pairs of correlations should be calculated between pairs of columns (num_in vs. num_corr-num_in); if num_in = num_corr, correlations are calculated between all columns

References Dakota::center_matrix_rows(), and SensAnalysisGlobal::correl_adjust().

Referenced by SensAnalysisGlobal::compute_correlations().

◆ partial_corr()

void partial_corr ( RealMatrix &  total_data,
const int  num_in,
const RealMatrix &  simple_corr_mat,
RealMatrix &  corr_matrix,
bool &  numerical_issues 
)
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().

Member Data Documentation

◆ numFns

size_t numFns
protected

◆ indexSi

RealVectorArray indexSi
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().


The documentation for this class was generated from the following files: