Dakota
Version
Explore and Predict with Confidence
|
Parent class for surrogate models. More...
Public Member Functions | |
Surrogate () | |
Constructor that uses defaultConfigOptions and does not build. | |
Surrogate (const ParameterList ¶m_list) | |
Constructor that sets configOptions but does not build. More... | |
Surrogate (const MatrixXd &samples, const MatrixXd &response, const ParameterList ¶m_list) | |
Constructor for the Surrogate that sets configOptions and builds the surrogate (does nothing in the base class). More... | |
virtual | ~Surrogate () |
Default destructor. | |
virtual void | build (const MatrixXd &samples, const MatrixXd &response)=0 |
Build the Surrogate using specified build data. More... | |
virtual VectorXd | value (const MatrixXd &eval_points, const int qoi)=0 |
Evaluate the Surrogate at a set of prediction points for a single QoI. More... | |
VectorXd | value (const MatrixXd &eval_points) |
Evaluate the Surrogate at a set of prediction points for QoI index 0. More... | |
virtual MatrixXd | gradient (const MatrixXd &eval_points, const int qoi) |
Evaluate the gradient of the Surrogate at a set of prediction points. More... | |
MatrixXd | gradient (const MatrixXd &eval_points) |
Evaluate the gradient of the Surrogate at a set of prediction points for QoI index 0. More... | |
virtual MatrixXd | hessian (const MatrixXd &eval_point, const int qoi) |
Evaluate the Hessian of the Surrogate at a single point. More... | |
MatrixXd | hessian (const MatrixXd &eval_point) |
Evaluate the Hessian of the Surrogate at a single point for QoI index 0. More... | |
void | variable_labels (const std::vector< std::string > &var_labels) |
Set the variable/feature names. More... | |
const std::vector< std::string > & | variable_labels () const |
Get the (possibly empty) variable/feature names. More... | |
void | response_labels (const std::vector< std::string > &resp_labels) |
Set the response/QoI names. More... | |
const std::vector< std::string > & | response_labels () const |
Get the (possibly empty) response/QoI names. More... | |
void | set_options (const ParameterList &options) |
Set the Surrogate's configOptions. More... | |
void | get_options (ParameterList &options) |
Get the Surrogate's configOptions. More... | |
void | print_options () |
Print the Surrogate's configOptions. | |
virtual void | default_options ()=0 |
Initialize the Surrogate's defaultConfigOptions. | |
VectorXd | evaluate_metrics (const StringArray &mnames, const MatrixXd &points, const MatrixXd &ref_values) |
Evalute metrics at specified points (within surrogates) | |
VectorXd | cross_validate (const MatrixXd &samples, const MatrixXd &response, const StringArray &mnames, const int num_folds=5, const int seed=20) |
Perform K-folds cross-validation (within surrogates) | |
template<typename DerivedSurr > | |
void | save (const DerivedSurr &surr_out, const std::string &outfile, const bool binary) |
Serialize a derived (i.e. non-base) surrogate model. More... | |
template<typename DerivedSurr > | |
void | load (const std::string &infile, const bool binary, DerivedSurr &surr_in) |
Load a derived (i.e. non-base) surrogate model. More... | |
Static Public Member Functions | |
template<typename SurrHandle > | |
static void | save (const SurrHandle &surr_out, const std::string &outfile, const bool binary) |
serialize Surrogate to file (typically through shared_ptr<Surrogate>, but Derived& or Derived* okay too) | |
template<typename SurrHandle > | |
static void | load (const std::string &infile, const bool binary, SurrHandle &surr_in) |
serialize Surrogate from file (typically through shared_ptr<Surrogate>, but Derived& or Derived* okay too) | |
static std::shared_ptr< Surrogate > | load (const std::string &infile, const bool binary) |
serialize Surrogate from file through pointer to base class (must have been saved via same data type) | |
Public Attributes | |
util::DataScaler | dataScaler |
DataScaler class for a Surrogate's build samples. | |
double | responseOffset = 0. |
Response offset. | |
double | responseScaleFactor = 1. |
Response scale factor. | |
Protected Member Functions | |
virtual std::shared_ptr< Surrogate > | clone () const =0 |
clone derived Surrogate class for use in cross-validation | |
Protected Attributes | |
int | numSamples |
Number of samples in the Surrogate's build samples. | |
int | numVariables |
Number of features/variables in the Surrogate's build samples. | |
std::vector< std::string > | variableLabels |
Names of the variables/features; need not be populated. | |
int | numQOI |
Number of quantities of interest predicted by the surrogate. For scalar-valued surrogates numQOI = 1. | |
std::vector< std::string > | responseLabels |
Names of the responses/QoIs; need not be populated. | |
ParameterList | defaultConfigOptions |
Default Key/value options to configure the surrogate. | |
ParameterList | configOptions |
Key/value options to configure the surrogate - will override defaultConfigOptions. | |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &archive, const unsigned int version) |
Serializer for base class data (call from dervied with base_object) | |
Friends | |
class | boost::serialization::access |
Allow serializers access to private class data. | |
Parent class for surrogate models.
The Surrogate class defines the API for surrogate models contained in the Dakota surrogates module.
Pure virtual functions include build, value, and default_options. Gradient and Hessian methods are optional.
Configuration options for a surrogate are set through the use of a Teuchos ParameterList named configOptions.
Surrogate | ( | const ParameterList & | param_list | ) |
Constructor that sets configOptions but does not build.
[in] | param_list | List that overrides entries in defaultConfigOptions. |
References Surrogate::numQOI, and dakota::silence_unused_args().
Surrogate | ( | const MatrixXd & | samples, |
const MatrixXd & | response, | ||
const ParameterList & | param_list | ||
) |
Constructor for the Surrogate that sets configOptions and builds the surrogate (does nothing in the base class).
[in] | samples | Matrix of data for surrogate construction - (num_samples by num_features). |
[in] | response | Vector of targets for surrogate construction - (num_samples by num_qoi = 1; only 1 response is supported currently). |
[in] | param_list | List that overrides entries in defaultConfigOptions. |
References Surrogate::numQOI, and dakota::silence_unused_args().
Build the Surrogate using specified build data.
[in] | samples | Matrix of data for surrogate construction - (num_samples by num_features). |
[in] | response | Vector of responses/targets for surrogate construction - (num_samples by num_qoi = 1). |
Implemented in PolynomialRegression, and GaussianProcess.
Evaluate the Surrogate at a set of prediction points for a single QoI.
[in] | eval_points | Matrix of prediction points - (num_pts by num_features). |
[in] | qoi | Index for surrogate QoI. |
Implemented in PolynomialRegression, and GaussianProcess.
Referenced by Surrogate::evaluate_metrics(), dakota::surrogates::fd_check_gradient(), dakota::surrogates::fd_check_hessian(), PYBIND11_MODULE(), PyPolyReg::value(), GaussianProcess::value(), and PolynomialRegression::value().
Evaluate the Surrogate at a set of prediction points for QoI index 0.
[in] | eval_points | Vector of prediction points - (num_features). |
References Surrogate::value().
Referenced by Surrogate::value().
Evaluate the gradient of the Surrogate at a set of prediction points.
[in] | eval_points | Matrix of prediction points - (num_pts by num_features). |
[in] | qoi | Index of the quantity of interest for gradient evaluation - 0 for scalar-valued surrogates. |
Reimplemented in PolynomialRegression, and GaussianProcess.
References dakota::silence_unused_args().
Referenced by dakota::surrogates::fd_check_gradient(), Surrogate::gradient(), GaussianProcess::gradient(), PolynomialRegression::gradient(), and PYBIND11_MODULE().
Evaluate the gradient of the Surrogate at a set of prediction points for QoI index 0.
[in] | eval_points | Matrix of prediction points
|
References Surrogate::gradient().
Evaluate the Hessian of the Surrogate at a single point.
[in] | eval_point | Coordinates of the prediction point - (1 by num_features). |
[in] | qoi | Index of the quantity of interest for Hessian evaluation - 0 for scalar-valued surrogates. |
Reimplemented in PolynomialRegression, and GaussianProcess.
References dakota::silence_unused_args().
Referenced by dakota::surrogates::fd_check_hessian(), Surrogate::hessian(), GaussianProcess::hessian(), PolynomialRegression::hessian(), and PYBIND11_MODULE().
Evaluate the Hessian of the Surrogate at a single point for QoI index 0.
[in] | eval_point | Coordinates of the prediction point - (1 by num_features). |
References Surrogate::hessian().
void variable_labels | ( | const std::vector< std::string > & | var_labels | ) |
Set the variable/feature names.
[in] | var_labels | Vector of strings, one per input variable |
References Surrogate::variableLabels.
const std::vector< std::string > & variable_labels | ( | ) | const |
Get the (possibly empty) variable/feature names.
References Surrogate::variableLabels.
Referenced by PYBIND11_MODULE().
void response_labels | ( | const std::vector< std::string > & | resp_labels | ) |
Set the response/QoI names.
[in] | resp_labels | Vector of strings, one per surrogate response |
References Surrogate::responseLabels.
const std::vector< std::string > & response_labels | ( | ) | const |
Get the (possibly empty) response/QoI names.
References Surrogate::responseLabels.
Referenced by PYBIND11_MODULE().
void set_options | ( | const ParameterList & | options | ) |
Set the Surrogate's configOptions.
[in] | options | ParameterList of configuration options. |
References Surrogate::configOptions.
void get_options | ( | ParameterList & | options | ) |
Get the Surrogate's configOptions.
[out] | options | ParameterList of configuration options. |
References Surrogate::configOptions.
void save | ( | const DerivedSurr & | surr_out, |
const std::string & | outfile, | ||
const bool | binary | ||
) |
Serialize a derived (i.e. non-base) surrogate model.
[in] | surr_out | Surrogate to seralize. |
[in] | outfile | Name of the output text or binary file. |
[in] | binary | Flag for binary or text format. |
void load | ( | const std::string & | infile, |
const bool | binary, | ||
DerivedSurr & | surr_in | ||
) |
Load a derived (i.e. non-base) surrogate model.
[in] | infile | Filename for serialized surrogate. |
[in] | binary | Flag for binary or text format. |
[in] | surr_in | Derived surrogate class to be populated with serialized data. |