DAKOTA: Design Analysis Kit for Optimization and Terascale Applications
  Copyright 2014-2020
  National Technology & Engineering Solutions of Sandia, LLC (NTESS).
  This software is distributed under the GNU Lesser General Public License.
  For more information, see the README file in the top Dakota directory.

Construct and evaluate surrogates using Dakota's surrogate library

This notebook demonstrates building two surrogate models, the first a polynomial and the second a Gaussian process. Each are evaluated at several points to obtain the function value, gradient, and Hessian. The variance of the GP model additionally is obtained.

Imports

The surrogates module is located within the dakota package.

Create test data

Create a 1D test function to model (tf), training data (xs, ys), and test points (ps).

Construct and evaluate polynomial model

The PolynomialRegression class builds polynomial models. Here, a full-order, quadratic polynomial is constructed. Function values, gradients, and Hessians are then obtained at ps. The results are plotted below alongside the GP results.

Construct and evaluate Gaussian process model

The GaussianProcess class builds Gaussian process models. Function values, gradients, Hessians, and variance are then obtained at ps. The results are plotted below alongside the polynomial results.

Plot the results

Save and load the surrogates

Finally, we demonstrate saving the models to disk, reloading them, and verifying that they produce the same evaluations. Surrogates built during a Dakota study can also be loaded and evaluated.