MUQ  0.4.3
Polynomial Chaos Expansions

Quickstart

The AdaptiveSmolyakPCE class uses the algorithm described in [Conrad2013] to adaptively construct polynomial chaos expansions. The PolynomialChaosExpansion class defines polynomial chaos expansions in MUQ.

C++
Python
// Define 1d quadrature rules for each dimension
auto quad1d = std::make_shared<GaussPattersonQuadrature>();
std::vector<std::shared_ptr<Quadrature>> quads(dim, quad1d);

// Define 1d orthogonal polynomial families for each dimension
auto polys1d = std::make_shared<Legendre>();
std::vector<std::shared_ptr<IndexedScalarBasis>> polys(dim, polys1d);

// Create the PCE solver
AdaptiveSmolyakPCE smolyPCE(model, quads, polys);

// Set solver options
boost::property_tree::ptree options;
options.put("ShouldAdapt", 1);     // After constructing an initial approximation with the terms in "multis", should we continue to adapt?
options.put("ErrorTol", 5e-4);    // Stop when the estimated L2 error is below this value
options.put("MaximumEvals", 200); // Stop adapting when more than this many model evaluations has occured

// Specify which terms we should start with
unsigned int initialOrder = 1;
auto multis = MultiIndexFactory::CreateTotalOrder(dim,initialOrder);

// Compute the polynomial chaos expansion
auto pce = smolyPCE.Compute(multis, options);

The pce variable is an instance of the PolynomialChaosExpansion class, which is itself a child of the ModPiece class. Many different functions are implemented for evaluating the PCE approximation and extracting information about the predictive distribution. For example,

C++
Python
// Prediction mean
Eigen::VectorXd predMean = pce->Mean();

// Prediction variance
Eigen::VectorXd predVar = pce->Variance();

// Full prediction covariance
Eigen::MatrixXd predCov = pce->Covariance();

// Total sensitivity matrix of each output wrt each input
Eigen::MatrixXd totalSens = pce->TotalSensitivity();

// Main effects matrix of each output wrt each individual input
Eigen::MatrixXd mainEffects = pce->MainSensitivity();

Additional Resources

See the PCE examples for more details on how to construct polynomial chaos expansions in MUQ.

Modules

 Polynomials
 Tools for constructing multivariate (orthogonal) polynomial expansions.
 
 Quadrature
 Tools for constructing univariate and multivariate quadrature rules.
 

Classes

class  muq::Approximation::PCEFactory
 Factory class for constructing a pseudo-spectral polynomial chaos approximation using a fixed quadrature rule. More...
 
class  muq::Approximation::PolynomialChaosExpansion
 A class for representing and using expansions of orthogonal multivariate polynomials. More...