CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
cmp::gp::MultiOutputGaussianProcess Class Reference

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 > &params, double nugget=1e-8)
 
 ~MultiOutputGaussianProcess ()=default
 
 MultiOutputGaussianProcess (const MultiOutputGaussianProcess &other)=default
 
MultiOutputGaussianProcessoperator= (const MultiOutputGaussianProcess &other)=default
 
 MultiOutputGaussianProcess (MultiOutputGaussianProcess &&other) noexcept=default
 
MultiOutputGaussianProcessoperator= (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 > &params, 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
 
GaussianProcessoperator[] (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< GaussianProcessgps_
 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.
 

Detailed Description

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

  1. condition() partitions the multi-column target matrix \(\mathbf{Y}\) to condition each internal GaussianProcess object.
  2. fit() sequentially optimizes hyperparameters for each GP in the collection using the specified MLE/LOO objectives.
  3. predict() queries predictions from each internal GP to reconstruct the multivariate output mean and variance vectors.

Constructor & Destructor Documentation

◆ MultiOutputGaussianProcess() [1/4]

cmp::gp::MultiOutputGaussianProcess::MultiOutputGaussianProcess ( )

◆ MultiOutputGaussianProcess() [2/4]

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 
)

◆ ~MultiOutputGaussianProcess()

cmp::gp::MultiOutputGaussianProcess::~MultiOutputGaussianProcess ( )
default

◆ MultiOutputGaussianProcess() [3/4]

cmp::gp::MultiOutputGaussianProcess::MultiOutputGaussianProcess ( const MultiOutputGaussianProcess other)
default

◆ MultiOutputGaussianProcess() [4/4]

cmp::gp::MultiOutputGaussianProcess::MultiOutputGaussianProcess ( MultiOutputGaussianProcess &&  other)
defaultnoexcept

Member Function Documentation

◆ condition()

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.

Parameters
xObsthe observation points
yObsthe observation values (each column corresponds to a different output dimension)
copyDatawhether to copy the observation data internally (default is true)

◆ fit()

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.

Parameters
xObsthe observation points
yObsthe observation values
lbthe lower bounds for the hyperparameters
ubthe upper bounds for the hyperparameters
methodthe fitting method (default is MLE)
algthe optimization algorithm (default is nlopt::LN_SBPLX)
tol_relthe relative tolerance for the optimization (default is 1e-3)
copyDatawhether to copy the observation data internally (default is true)
priorthe prior distribution for the hyperparameters (default is uniform prior)
logScalea vector indicating which hyperparameters should be optimized in log scale (default is all false)

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ operator[]()

◆ predict()

std::pair< Eigen::VectorXd, Eigen::MatrixXd > cmp::gp::MultiOutputGaussianProcess::predict ( const Eigen::Ref< const Eigen::VectorXd > &  x,
const type t = type::POSTERIOR 
) const

◆ predictMean()

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.

Parameters
xThe test point.
tEvaluation type (PRIOR or POSTERIOR).
Returns
Predictive mean vector.

◆ set()

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.

Parameters
nGpsthe number of Gaussian Processes
kernelthe covariance function
meanthe mean function
paramsthe hyperparameters
nuggetthe nugget value

◆ size()

size_t cmp::gp::MultiOutputGaussianProcess::size ( ) const
inline

Returns the number of output dimensions (the number of GP models).

Returns
Size of the GP collection.

Member Data Documentation

◆ gps_

std::vector<GaussianProcess> cmp::gp::MultiOutputGaussianProcess::gps_
private

Collection of single-output Gaussian Process models.

◆ pXObs_

std::optional<Eigen::Ref<const Eigen::MatrixXd> > cmp::gp::MultiOutputGaussianProcess::pXObs_
private

Non-owning reference wrapper to training input matrix.

◆ pYObs_

std::optional<Eigen::Ref<const Eigen::MatrixXd> > cmp::gp::MultiOutputGaussianProcess::pYObs_
private

Non-owning reference wrapper to training output target matrix.

◆ xObs_

Eigen::MatrixXd cmp::gp::MultiOutputGaussianProcess::xObs_
private

Owning training input matrix.

◆ yObs_

Eigen::MatrixXd cmp::gp::MultiOutputGaussianProcess::yObs_
private

Owning training output target matrix.


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