|
CMP++: Uncertainty Quantification & Bayesian Calibration
|
Manages a collection of independent Gaussian Processes for multi-output regression. More...
#include <multi_gp.h>
Public Member Functions | |
| MultiOutputGaussianProcess () | |
| MultiOutputGaussianProcess (const size_t &nGps, const std::shared_ptr< covariance::Covariance > &kernel, const std::shared_ptr< mean::Mean > &mean, const Eigen::Ref< const Eigen::VectorXd > ¶ms, double nugget=1e-8) | |
| ~MultiOutputGaussianProcess ()=default | |
| MultiOutputGaussianProcess (const MultiOutputGaussianProcess &other)=default | |
| MultiOutputGaussianProcess & | operator= (const MultiOutputGaussianProcess &other)=default |
| MultiOutputGaussianProcess (MultiOutputGaussianProcess &&other) noexcept=default | |
| MultiOutputGaussianProcess & | operator= (MultiOutputGaussianProcess &&other) noexcept=default |
| void | set (const size_t &nGps, const std::shared_ptr< covariance::Covariance > &kernel, const std::shared_ptr< mean::Mean > &mean, const Eigen::Ref< const Eigen::VectorXd > ¶ms, double nugget=1e-8) |
| Set the number of Gaussian Processes and their parameters. | |
| void | condition (const Eigen::Ref< const Eigen::MatrixXd > &xObs, const Eigen::Ref< const Eigen::MatrixXd > &yObs, bool copyData=true) |
| Set the values of the observations. | |
| void | fit (const Eigen::Ref< Eigen::MatrixXd > &xObs, const Eigen::Ref< Eigen::MatrixXd > &yObs, const Eigen::Ref< const Eigen::VectorXd > &lb, const Eigen::Ref< const Eigen::VectorXd > &ub, const method &method=MLE, const nlopt::algorithm &alg=nlopt::LN_SBPLX, const double &tol_rel=1e-3, bool copyData=true, const std::shared_ptr< cmp::prior::Prior > &prior=cmp::prior::Uniform::make(), const std::vector< bool > &logScale={}) |
| Fit the Gaussian Process to the observations. | |
| std::pair< Eigen::VectorXd, Eigen::MatrixXd > | predict (const Eigen::Ref< const Eigen::VectorXd > &x, const type &t=type::POSTERIOR) const |
| GaussianProcess & | operator[] (const int &i) |
| size_t | size () const |
| Returns the number of output dimensions (the number of GP models). | |
| Eigen::VectorXd | predictMean (const Eigen::Ref< const Eigen::VectorXd > &x, const type &t=type::POSTERIOR) const |
| Predicts the output mean vector at the test point x. | |
Private Attributes | |
| std::vector< GaussianProcess > | gps_ |
| Collection of single-output Gaussian Process models. | |
| Eigen::MatrixXd | xObs_ |
| Owning training input matrix. | |
| Eigen::MatrixXd | yObs_ |
| Owning training output target matrix. | |
| std::optional< Eigen::Ref< const Eigen::MatrixXd > > | pXObs_ |
| Non-owning reference wrapper to training input matrix. | |
| std::optional< Eigen::Ref< const Eigen::MatrixXd > > | pYObs_ |
| Non-owning reference wrapper to training output target matrix. | |
Manages a collection of independent Gaussian Processes for multi-output regression.
Mathematical Formulation Models a vector-valued function \(\mathbf{f}: \mathbb{R}^D \to \mathbb{R}^M\) using \(M\) independent Gaussian Processes:
\[ f_j(\mathbf{x}) \sim \mathcal{GP}\left(m_j(\mathbf{x}), k_j(\mathbf{x}, \mathbf{x}')\right), \quad j = 0, \dots, M-1 \]
Often used in combination with PCA dimension reduction, where the high-dimensional response vector \(\mathbf{y} \in \mathbb{R}^Q\) is projected onto \(M\) principal components, and each component is modeled by a separate GP.
Implementation Algorithm
condition() partitions the multi-column target matrix \(\mathbf{Y}\) to condition each internal GaussianProcess object.fit() sequentially optimizes hyperparameters for each GP in the collection using the specified MLE/LOO objectives.predict() queries predictions from each internal GP to reconstruct the multivariate output mean and variance vectors. | cmp::gp::MultiOutputGaussianProcess::MultiOutputGaussianProcess | ( | ) |
| cmp::gp::MultiOutputGaussianProcess::MultiOutputGaussianProcess | ( | const size_t & | nGps, |
| const std::shared_ptr< covariance::Covariance > & | kernel, | ||
| const std::shared_ptr< mean::Mean > & | mean, | ||
| const Eigen::Ref< const Eigen::VectorXd > & | params, | ||
| double | nugget = 1e-8 |
||
| ) |
|
default |
|
default |
|
defaultnoexcept |
| void cmp::gp::MultiOutputGaussianProcess::condition | ( | const Eigen::Ref< const Eigen::MatrixXd > & | xObs, |
| const Eigen::Ref< const Eigen::MatrixXd > & | yObs, | ||
| bool | copyData = true |
||
| ) |
Set the values of the observations.
| xObs | the observation points |
| yObs | the observation values (each column corresponds to a different output dimension) |
| copyData | whether to copy the observation data internally (default is true) |
| void cmp::gp::MultiOutputGaussianProcess::fit | ( | const Eigen::Ref< Eigen::MatrixXd > & | xObs, |
| const Eigen::Ref< Eigen::MatrixXd > & | yObs, | ||
| const Eigen::Ref< const Eigen::VectorXd > & | lb, | ||
| const Eigen::Ref< const Eigen::VectorXd > & | ub, | ||
| const method & | method = MLE, |
||
| const nlopt::algorithm & | alg = nlopt::LN_SBPLX, |
||
| const double & | tol_rel = 1e-3, |
||
| bool | copyData = true, |
||
| const std::shared_ptr< cmp::prior::Prior > & | prior = cmp::prior::Uniform::make(), |
||
| const std::vector< bool > & | logScale = {} |
||
| ) |
Fit the Gaussian Process to the observations.
| xObs | the observation points |
| yObs | the observation values |
| lb | the lower bounds for the hyperparameters |
| ub | the upper bounds for the hyperparameters |
| method | the fitting method (default is MLE) |
| alg | the optimization algorithm (default is nlopt::LN_SBPLX) |
| tol_rel | the relative tolerance for the optimization (default is 1e-3) |
| copyData | whether to copy the observation data internally (default is true) |
| prior | the prior distribution for the hyperparameters (default is uniform prior) |
| logScale | a vector indicating which hyperparameters should be optimized in log scale (default is all false) |
|
default |
|
defaultnoexcept |
|
inline |
| std::pair< Eigen::VectorXd, Eigen::MatrixXd > cmp::gp::MultiOutputGaussianProcess::predict | ( | const Eigen::Ref< const Eigen::VectorXd > & | x, |
| const type & | t = type::POSTERIOR |
||
| ) | const |
| Eigen::VectorXd cmp::gp::MultiOutputGaussianProcess::predictMean | ( | const Eigen::Ref< const Eigen::VectorXd > & | x, |
| const type & | t = type::POSTERIOR |
||
| ) | const |
Predicts the output mean vector at the test point x.
| x | The test point. |
| t | Evaluation type (PRIOR or POSTERIOR). |
| void cmp::gp::MultiOutputGaussianProcess::set | ( | const size_t & | nGps, |
| const std::shared_ptr< covariance::Covariance > & | kernel, | ||
| const std::shared_ptr< mean::Mean > & | mean, | ||
| const Eigen::Ref< const Eigen::VectorXd > & | params, | ||
| double | nugget = 1e-8 |
||
| ) |
Set the number of Gaussian Processes and their parameters.
| nGps | the number of Gaussian Processes |
| kernel | the covariance function |
| mean | the mean function |
| params | the hyperparameters |
| nugget | the nugget value |
|
inline |
Returns the number of output dimensions (the number of GP models).
|
private |
Collection of single-output Gaussian Process models.
|
private |
Non-owning reference wrapper to training input matrix.
|
private |
Non-owning reference wrapper to training output target matrix.
|
private |
Owning training input matrix.
|
private |
Owning training output target matrix.