Dakota
Version
Explore and Predict with Confidence
|
namespace for new Dakota utilities module More...
Classes | |
class | CholeskySolver |
The CholeskySolver class is used to solve linear systems with a symmetric matrix with a pivoted Cholesky decomposition. More... | |
class | DataScaler |
The DataScaler class computes the scaling coefficients and scales a 2D data matrix with dimensions num_samples by num_features. More... | |
class | LinearSolverBase |
The LinearSolverBase class serves as an API for derived solvers. More... | |
class | LUSolver |
The LUSolver class is used to solve linear systems with the LU decomposition. More... | |
class | NormalizationScaler |
Normalizes the data using max and min feature values. More... | |
class | NoScaler |
Leaves the data unscaled. More... | |
class | QRSolver |
The QRSolver class solves the linear least squares problem with a QR decomposition. More... | |
class | StandardizationScaler |
Standardizes the data so the each feature has zero mean and unit variance. More... | |
class | SVDSolver |
The SVDSolver class is used to solve linear systems with the singular value decomposition. More... | |
Typedefs | |
using | BimapMetrictypeStr = boost::bimap< METRIC_TYPE, std::string > |
alias for Boost Bimap metric type <--> string | |
using | SCALER_TYPE = DataScaler::SCALER_TYPE |
alias for DataScaler's SCALER_TYPE | |
using | BimapScalertypeStr = boost::bimap< SCALER_TYPE, std::string > |
alias for Boost Bimap scaler type <--> string | |
using | SOLVER_TYPE = LinearSolverBase::SOLVER_TYPE |
alias for LinearSolverBase's SOLVER_TYPE | |
using | BimapSolvertypeStr = boost::bimap< SOLVER_TYPE, std::string > |
alias for Boost Bimap solver type <--> string | |
Enumerations | |
enum | METRIC_TYPE { SUM_SQUARED, MEAN_SQUARED, ROOT_MEAN_SQUARED, SUM_ABS, MEAN_ABS, MAX_ABS, ABS_PERCENTAGE_ERROR, MEAN_ABS_PERCENTAGE_ERROR, R_SQUARED } |
Enumeration for supported metric types. | |
Functions | |
void | error (const std::string &msg) |
Throws a std::runtime_error based on the message argument. More... | |
bool | matrix_equals (const MatrixXi &A, const MatrixXi &B) |
Tests whether two Eigen MatrixXi objects are equal. More... | |
bool | matrix_equals (const MatrixXd &A, const MatrixXd &B, double tol) |
Tests whether two Eigen MatrixXd objects are equal, within a given tolerance. More... | |
bool | matrix_equals (const RealMatrix &A, const RealMatrix &B, double tol) |
Tests whether two Teuchos RealMatrix objects are equal, within a given tolerance. More... | |
bool | relative_allclose (const MatrixXd &A, const MatrixXd &B, const double tol) |
Tests whether two Eigen MatrixXd objects relatively equal (element-wise) within a given tolerance. More... | |
double | variance (const VectorXd &vec) |
Calculates the variance based on an Eigen VectorXd of double values. More... | |
void | populateVectorsFromFile (const std::string &filename, std::vector< VectorXd > &R, int num_datasets, int num_samples) |
Populate a collection of vectors read in a from a text file assuming data layout is one dataset per row. More... | |
void | populateMatricesFromFile (const std::string &filename, std::vector< MatrixXd > &S, int num_datasets, int num_vars, int num_samples) |
Populate a collection of matrices read in a from a text file assuming data layout is a "column-major" stack of num_samples by num_vars matrices. More... | |
int | n_choose_k (int n, int k) |
Calculate Binomial coefficient n choose k. More... | |
void | random_permutation (const int num_pts, const unsigned int seed, VectorXi &permutations) |
Random permutation of int array. | |
void | create_cv_folds (const int num_folds, const int num_pts, std::vector< VectorXi > &fold_indices, const int seed=22) |
Generate indices for cross validation folds. | |
MatrixXd | create_uniform_random_double_matrix (const int rows, const int cols) |
Generate a real-valued matrix of uniformly distributed random values. | |
MatrixXd | create_uniform_random_double_matrix (const int rows, const int cols, const unsigned int seed) |
Generate a real-valued matrix of uniformly distributed random values. | |
MatrixXd | create_uniform_random_double_matrix (const int rows, const int cols, const unsigned int seed, bool transform, const double low, const double high) |
Generate a real-valued matrix of uniformly distributed random values. | |
template<typename T > | |
int | num_nonzeros (const T &mat) |
Caclulate and return number of nonzero entries in vector or matrix. More... | |
template<typename T1 , typename T2 > | |
void | nonzero (const T1 &v, T2 &result) |
Create a vector of indices based on nonzero entries in input vector. More... | |
template<typename T1 , typename T2 > | |
void | append_columns (const T1 &new_cols, T2 &target) |
Append columns of input matrix to existing matrix. More... | |
template<typename T > | |
double | p_norm (const T &v, double p) |
Caclulate and return p-norm of a vector. More... | |
METRIC_TYPE | metric_type (const std::string &metric_name) |
Convert the metric from string to enum. More... | |
double | compute_metric (const VectorXd &p, const VectorXd &d, const std::string &metric_name) |
Computes the difference between prediction and data vectors. More... | |
std::shared_ptr< DataScaler > | scaler_factory (DataScaler::SCALER_TYPE scaler_type, const MatrixXd &unscaled_matrix) |
Free function to construct DataScaler. More... | |
std::shared_ptr< LinearSolverBase > | solver_factory (LinearSolverBase::SOLVER_TYPE type) |
Free function to construct LinearSolverBase. More... | |
Variables | |
static BimapMetrictypeStr | type_name_bimap |
Bimap between metric types and names. More... | |
static BimapScalertypeStr | type_name_bimap |
Bimap between scaler types and names. More... | |
static BimapSolvertypeStr | type_name_bimap |
Bimap between solver types and names. More... | |
namespace for new Dakota utilities module
void error | ( | const std::string & | msg | ) |
Throws a std::runtime_error based on the message argument.
[in] | msg | The error message to throw |
Referenced by compute_metric(), create_cv_folds(), and matrix_equals().
Tests whether two Eigen MatrixXi objects are equal.
[in] | A | The first matrix to test |
[in] | B | The second matrix to test |
Tests whether two Eigen MatrixXd objects are equal, within a given tolerance.
[in] | A | The first matrix to test |
[in] | B | The second matrix to test |
[in] | tol | The tolerance to use when comparing double values |
References error().
bool matrix_equals | ( | const RealMatrix & | A, |
const RealMatrix & | B, | ||
double | tol | ||
) |
Tests whether two Teuchos RealMatrix objects are equal, within a given tolerance.
[in] | A | The first matrix to test |
[in] | B | The second matrix to test |
[in] | tol | The tolerance to use when comparing double values |
References error().
Tests whether two Eigen MatrixXd objects relatively equal (element-wise) within a given tolerance.
[in] | A | The first matrix to test |
[in] | B | The second matrix to test |
[in] | tol | The relative tolerance to use when comparing double values |
double variance | ( | const VectorXd & | vec | ) |
Calculates the variance based on an Eigen VectorXd of double values.
[in] | vec | The vector |
void populateVectorsFromFile | ( | const std::string & | filename, |
std::vector< VectorXd > & | R, | ||
int | num_datasets, | ||
int | num_samples | ||
) |
Populate a collection of vectors read in a from a text file assuming data layout is one dataset per row.
[in] | filename | The file that contains the data |
[out] | R | The collection of vectors to be populated |
[in] | num_datasets | The number of datasets to read in |
[in] | num_samples | The number of data points (e.g. function values, build points) per dataset |
void populateMatricesFromFile | ( | const std::string & | filename, |
std::vector< MatrixXd > & | S, | ||
int | num_datasets, | ||
int | num_vars, | ||
int | num_samples | ||
) |
Populate a collection of matrices read in a from a text file assuming data layout is a "column-major" stack of num_samples by num_vars matrices.
[in] | filename | The file that contains the data |
[out] | S | The collection of vectors to be populated |
[in] | num_datasets | The number of datasets to read in |
[in] | num_samples | The number of data points (e.g. function values, build points) per dataset (row dim) |
[in] | num_vars | The number of variables per dataset (column dim) |
int n_choose_k | ( | int | n, |
int | k | ||
) |
Calculate Binomial coefficient n choose k.
[in] | n | Number of elements in set |
[in] | k | Number of elements in subset k where n >= k >= 0 |
Referenced by dakota::surrogates::size_level_index_vector().
int dakota::util::num_nonzeros | ( | const T & | mat | ) |
Caclulate and return number of nonzero entries in vector or matrix.
[in] | mat | Incoming vector or matrix |
Referenced by dakota::surrogates::compute_hyperbolic_level_indices(), dakota::surrogates::compute_hyperbolic_subdim_level_indices(), and nonzero().
void dakota::util::nonzero | ( | const T1 & | v, |
T2 & | result | ||
) |
Create a vector of indices based on nonzero entries in input vector.
[in] | v | Incoming vector |
[out] | result | Vector having values at nonzero locations of incoming vector and value equal to ordinal of occurrence |
References num_nonzeros().
Referenced by dakota::surrogates::compute_hyperbolic_level_indices().
void dakota::util::append_columns | ( | const T1 & | new_cols, |
T2 & | target | ||
) |
Append columns of input matrix to existing matrix.
[in] | new_cols | Incoming matrix of column vectors to append |
[out] | target | Matrix to augment with appended columns |
Referenced by dakota::surrogates::compute_hyperbolic_indices(), dakota::surrogates::compute_hyperbolic_level_indices(), and dakota::surrogates::compute_reduced_indices().
double dakota::util::p_norm | ( | const T & | v, |
double | p | ||
) |
Caclulate and return p-norm of a vector.
[in] | v | Incoming vector |
[in] | p | Order or norm to compute |
Referenced by dakota::surrogates::compute_hyperbolic_subdim_level_indices().
METRIC_TYPE metric_type | ( | const std::string & | metric_name | ) |
Convert the metric from string to enum.
[in] | metric_name | metric |
References type_name_bimap.
Referenced by compute_metric().
Computes the difference between prediction and data vectors.
[in] | p | prediction vector. |
[in] | d | data vector. |
[in] | metric_name | metric to compute. |
References error(), and metric_type().
Referenced by Dakota::compute_regression_coeffs(), and Surrogate::evaluate_metrics().
std::shared_ptr< DataScaler > scaler_factory | ( | DataScaler::SCALER_TYPE | scaler_type, |
const MatrixXd & | unscaled_matrix | ||
) |
Free function to construct DataScaler.
[in] | scaler_type | Which scaler to construct |
[in] | unscaled_matrix | Unscaled data matrix - (num_samples by num_features) |
Referenced by GaussianProcess::build(), and PolynomialRegression::build().
std::shared_ptr< LinearSolverBase > solver_factory | ( | LinearSolverBase::SOLVER_TYPE | type | ) |
Free function to construct LinearSolverBase.
[in] | type | Which solver to construct |
Referenced by PolynomialRegression::build().
|
static |
Bimap between metric types and names.
Referenced by metric_type(), DataScaler::scaler_type(), and LinearSolverBase::solver_type().
|
static |
Bimap between scaler types and names.
|
static |
Bimap between solver types and names.