Covariance System
Overview
Some surrogate models allow for a covariance function (often referred to as kernel functions or simply kernels) to project the input parameters into a different input space. The Gaussian process surrogate is an example of such a surrogate. These covariance functions can be defined in the [Covariance] block.
Creating a Covariance Function
A covariance function is created by inheriting from CovarianceFunctionBase and overriding the methods in the base class.
Using a Covariance Function
In the GaussianProcess
The GaussianProcess is a class which incorporates the necessary data structures and functions to create, train, and use Gaussian Processes. One of the most important members of this handler class is the covariance function:
CovarianceFunctionBase * _covariance_function = nullptr;
(modules/stochastic_tools/include/utils/GaussianProcess.h)The covariance function can be initialized in the handler by following the examples given in source description. Objects like GaussianProcessTrainer or GaussianProcess can then access the covariance function through the handler class.
CovarianceInterface
Alternatively, by inheriting from CovarianceInterface, the child classes can easily fetch covariance functions using the helper functions. Good examples are the GaussianProcessTrainer and GaussianProcess which utilize the helper functions to link an input covariance function to the GaussianProcess:
_gp.initialize(getCovarianceFunctionByName(parameters.get<UserObjectName>("covariance_function")),
tune_parameters,
lower_bounds,
upper_bounds);
_n_outputs = _gp.getCovarFunction().numOutputs();
(modules/stochastic_tools/src/trainers/GaussianProcessTrainer.C)In a Surrogate
If the surrogate loads the training data from a file, the LoadCovarianceDataAction automatically reconstructs the covariance object used in the training phase, and calls the surrogate setupCovariance() method to make the linkage. This recreation is done by storing the hyper parameter map in the Gaussian Process handler of the trainer for use in the surrogate.
Dependencies between Covariance objects
Some covariance functions may depend on other covariance functions for adding complexity. A typical scenario can be a Gaussian Process built using the Linear Model of Coregionalization that predicts multiple outputs at once by handling the covariance between the outputs as well.
Example Input File Syntax
[Covariance<<<{"href": "index.html"}>>>]
[covar]
type = SquaredExponentialCovariance<<<{"description": "Squared Exponential covariance function.", "href": "../../source/covariances/SquaredExponentialCovariance.html"}>>>
signal_variance<<<{"description": "Signal Variance ($\\sigma_f^2$) to use for kernel calculation."}>>> = 1 #Use a signal variance of 1 in the kernel
noise_variance<<<{"description": "Noise Variance ($\\sigma_n^2$) to use for kernel calculation."}>>> = 1e-6 #A small amount of noise can help with numerical stability
length_factor<<<{"description": "Length factors to use for Covariance Kernel"}>>> = '0.38971 0.38971' #Select a length factor for each parameter (k and q)
[]
[](modules/stochastic_tools/test/tests/surrogates/gaussian_process/GP_squared_exponential_training.i)Available Objects
- Stochastic Tools App
- ExponentialCovarianceExponential covariance function.
- LMCCovariance function for multioutput Gaussian Processes based on the Linear Model of Coregionalization (LMC).
- MaternHalfIntCovarianceMatern half-integer covariance function.
- SquaredExponentialCovarianceSquared Exponential covariance function.
Available Actions
- Stochastic Tools App
- AddCovarianceActionAdds Covariance objects contained within the
[Trainers]and[Surrogates]input blocks.