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 GaussianProcessHandler

The GaussianProcessHandler 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/GaussianProcessHandler.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 GaussianProcessHandler:

  _gp_handler.initialize(
      getCovarianceFunctionByName(parameters.get<UserObjectName>("covariance_function")),
      tune_parameters,
      lower_bounds,
      upper_bounds);
(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.

Example Input File Syntax

[Covariance]
  [covar]
    type = SquaredExponentialCovariance
    signal_variance = 1 #Use a signal variance of 1 in the kernel
    noise_variance = 1e-6 #A small amount of noise can help with numerical stability
    length_factor = '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

Available Actions

  • Stochastic Tools App
  • AddCovarianceActionAdds Covariance objects contained within the [Trainers] and [Surrogates] input blocks.