Used to compute and evaluate the Karhunen-Loeve decomposition of a zero mean Gaussian process. @sealso SeperableKarhunenLoeve. More...
#include <KarhunenLoeveExpansion.h>
Used to compute and evaluate the Karhunen-Loeve decomposition of a zero mean Gaussian process. @sealso SeperableKarhunenLoeve.
According to the Karhunen-Loeve theorem, under mild technical conditions, a zero mean (i.e., centered) stochastic process admits a decomposition of the form
\[ u(x) = \sum_{k=1}^\infty \phi_k(x) z_k, \]
where \(u(x)\) is the original stochastic process, \(\phi_k(x)\) is deterministic basis function, and \(z_k\) are uncorrelated random variables. Notice that this Karhunen-Loeve decomposition is a continuous analog of standard principle component decompositions for finite dimensional random variables.
For a Gaussian process, the basis functions \(\phi_k(x)\) can be calculated from the covariance kernel defining the process. In particular, each \(z_k\) will be an indepedent standard normal random variable and \(\phi_k(x)\) will be given by
\[ \phi_k(x) = \sqrt{\lambda_k} e_k(x), \]
where \(\lambda_k\) and \(e_k(x)\) are the \(k^{th}\) eigenvalue and eigenvector of the covariance kernel \(k(x,x^\prime)\). In particular, \(\lambda_k\) and \(e_k(x)\) satisfy
\[ \int_\Omega k(x,x^\prime) e_k(x) dx = \lambda_k e_k(x^\prime). \]
The constructor of this class uses the Nystrom method to approximately solve for \(\lambda_k\) and \(e_k(x)\). The method starts with a set of \(N\) seed (quadrature) points \(x_i\) and a set of weights \(w_i\) that satisfy
\[ \int_\Omega k(x,x^\prime) e_k(x) dx \approx \sum_{i=1}^N w_i k(x_i,x^\prime) e_k(x^\prime), \]
which allows us to approximately solve for \(e_k(x)\) and \(\lambda_k\) by replacing \(x^\prime\) with $ \(x_i\) for each \(i\) and solving the resulting \(N\times N\) matrix eigenproblem. Once the matrix problem is solved, we will have approximations of \(e_k(x_i)\). The value of the eigenfunction at other locations is approximated using the covariance kernel
\[ e_k(x^\prime) = \frac{1}{\lambda_k} \sum_{i=1}^N w_i k(x_i, x^\prime) e_k(x_i). \]
Notice that the approximation quality largely depends on how well the seed points and weights approximate the integral. For simple domains (e.g., rectangular), it is thus useful to choose the seed points and weights from efficient quadrature rules.
Definition at line 98 of file KarhunenLoeveExpansion.h.
Public Member Functions | |
KarhunenLoeveExpansion (std::shared_ptr< KernelBase > kernelIn, Eigen::MatrixXd const &seedPtsIn, Eigen::VectorXd const &seedWtsIn, boost::property_tree::ptree options=boost::property_tree::ptree()) | |
virtual | ~KarhunenLoeveExpansion ()=default |
virtual Eigen::MatrixXd | GetModes (Eigen::Ref< const Eigen::MatrixXd > const &pts) const override |
virtual unsigned int | NumModes () const override |
Public Member Functions inherited from muq::Approximation::KarhunenLoeveBase | |
virtual | ~KarhunenLoeveBase ()=default |
virtual Eigen::VectorXd | Evaluate (Eigen::Ref< const Eigen::MatrixXd > const &pts, Eigen::Ref< const Eigen::VectorXd > const &coeffs) const |
Evaluate the KL expansion at a new pt given known coefficients. More... | |
KarhunenLoeveExpansion::KarhunenLoeveExpansion | ( | std::shared_ptr< KernelBase > | kernelIn, |
Eigen::MatrixXd const & | seedPtsIn, | ||
Eigen::VectorXd const & | seedWtsIn, | ||
boost::property_tree::ptree | options = boost::property_tree::ptree() |
||
) |
|
virtualdefault |
|
overridevirtual |
Evaluates the KL modes at one or more locations. Each column of the pts matrix contains a point where we want to evaluate the modes. Each column of the output contains a mode. Each row of the output corresponds to an input point.
Implements muq::Approximation::KarhunenLoeveBase.
Definition at line 34 of file KarhunenLoeveExpansion.cpp.
References covKernel, modeEigs, modeVecs, seedPts, and seedWts.
Referenced by ConstructDensity().
|
overridevirtual |
Implements muq::Approximation::KarhunenLoeveBase.
Definition at line 45 of file KarhunenLoeveExpansion.cpp.
References modeEigs.
|
private |
Definition at line 124 of file KarhunenLoeveExpansion.h.
Referenced by GetModes(), and KarhunenLoeveExpansion().
|
private |
Definition at line 128 of file KarhunenLoeveExpansion.h.
Referenced by GetModes(), KarhunenLoeveExpansion(), and NumModes().
|
private |
Definition at line 127 of file KarhunenLoeveExpansion.h.
Referenced by GetModes(), and KarhunenLoeveExpansion().
|
private |
Definition at line 120 of file KarhunenLoeveExpansion.h.
Referenced by GetModes(), and KarhunenLoeveExpansion().
|
private |
Definition at line 121 of file KarhunenLoeveExpansion.h.
Referenced by GetModes(), and KarhunenLoeveExpansion().