Surrogate Functions

A surrogte model is associated with each simulation when its simulation dictionary is added to the MOOP object. This technique is used for generatng an approximation to the simulation’s response surface, based on data gathered during the solve.

from parmoo import surrogates

Available techniques are:

Gaussian Process (RBF) Models

Implementations of the SurrogateFunction class.

This module contains implementations of the SurrogateFunction ABC, which rely on Gaussian basis functions (i.e., Gaussian processes).

The classes include:
  • GaussRBF – fits Gaussian radial basis functions (RBFs)

  • LocalGaussRBF – fits Gaussian radial basis functions (RBFs) locally

class surrogates.gaussian_proc.GaussRBF(m, lb, ub, hyperparams)

A RBF surrogate model, using a Gaussian basis.

This class implements a RBF surrogate with a Gaussian basis, using the SurrogateFunction ABC.

__init__(m, lb, ub, hyperparams)

Constructor for the GaussRBF class.

Parameters:
  • m (int) – The number of objectives to fit.

  • lb (numpy.ndarray) – A 1d array of lower bounds for the design region. The number of design variables is inferred from the dimension of lb.

  • ub (numpy.ndarray) – A 1d array of upper bounds for the design region. The dimension must match ub.

  • hyperparams (dict) –

    A dictionary of hyperparameters for the RBF models, including:

    • des_tols (numpy.ndarray, optional): A 1d array whose length matches lb and ub. Each entry is a number (greater than 0) specifying the design space tolerance for that variable. By default, des_tols = [1.0e-8, …, 1.0e-8].

Returns:

A new GaussRBF object.

Return type:

GaussRBF

fit(x, f)

Fit a new Gaussian RBF to the given data.

Parameters:
  • x (numpy.ndarray) – A 2d array containing the list of design points.

  • f (numpy.ndarray) – A 2d array containing the corresponding list of objective values.

update(x, f)

Update an existing Gaussian RBF using new data.

Parameters:
  • x (numpy.ndarray) – A 2d array containing the list of new design points, with which to update the surrogate models.

  • f (numpy.ndarray) – A 2d array containing the corresponding list of objective values.

evaluate(x)

Evaluate the Gaussian RBF at a design point.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which to the Gaussian RBF should be evaluated.

Returns:

A 1d array containing the predicted objective value at x.

Return type:

numpy.ndarray

gradient(x)

Evaluate the gradients of the Gaussian RBF at a design point.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which the gradient of the RBF should be evaluated.

Returns:

A 2d array containing the Jacobian matrix of the RBF interpolants at x.

Return type:

numpy.ndarray

stdDev(x)

Evaluate the standard deviation (uncertainty) of the Gaussian RBF at x.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which the standard deviation should be evaluated.

Returns:

A 1d array containing the standard deviation at x.

Return type:

numpy.ndarray

stdDevGrad(x)

Evaluate the gradient of the standard deviation of the GaussRBF at x.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which the gradient of standard deviation should be evaluated.

Returns:

A 2d array containing the Jacobian matrix of the standard deviation at x.

Return type:

numpy.ndarray

save(filename)

Save important data from this class so that it can be reloaded.

Parameters:

filename (string) – The relative or absolute path to the file where all reload data should be saved.

load(filename)

Reload important data into this class after a previous save.

Parameters:

filename (string) – The relative or absolute path to the file where all reload data has been saved.

class surrogates.gaussian_proc.LocalGaussRBF(m, lb, ub, hyperparams)

A local RBF surrogate model, using a Gaussian basis.

This class implements a local RBF surrogate with a Gaussian basis, using the SurrogateFunction ABC.

__init__(m, lb, ub, hyperparams)

Constructor for the LocalGaussRBF class.

Parameters:
  • m (int) – The number of objectives to fit.

  • lb (numpy.ndarray) – A 1d array of lower bounds for the design region. The number of design variables is inferred from the dimension of lb.

  • ub (numpy.ndarray) – A 1d array of upper bounds for the design region. The dimension must match ub.

  • hyperparams (dict) –

    A dictionary of hyperparameters for the RBF models, including:

    • des_tols (numpy.ndarray, optional): A 1d array whose length matches lb and ub. Each entry is a number (greater than 0) specifying the design space tolerance for that variable. By default, des_tols = [1.0e-8, …, 1.0e-8].

Returns:

A new LocalGaussRBF object.

Return type:

LocalGaussRBF

fit(x, f)

Fit a new Gaussian RBF to the given data.

Parameters:
  • x (numpy.ndarray) – A 2d array containing the list of design points.

  • f (numpy.ndarray) – A 2d array containing the corresponding list of objective values.

update(x, f)

Update an existing Gaussian RBF using new data.

Parameters:
  • x (numpy.ndarray) – A 2d array containing the list of new design points, with which to update the surrogate models.

  • f (numpy.ndarray) – A 2d array containing the corresponding list of objective values.

setCenter(center)

Set the new trust region center and refit the local RBF.

Parameters:

center (numpy.ndarray) – A 1d array containing the new trust region center.

Returns:

The standard deviation used for fitting the surrogates, which should be used as the trust region radius for a local optimizer.

Return type:

float

evaluate(x)

Evaluate the Gaussian RBF at a design point.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which to the Gaussian RBF should be evaluated.

Returns:

A 1d array containing the predicted objective value at x.

Return type:

numpy.ndarray

gradient(x)

Evaluate the gradients of the Gaussian RBF at a design point.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which the gradient of the RBF should be evaluated.

Returns:

A 2d array containing the Jacobian matrix of the RBF interpolants at x.

Return type:

numpy.ndarray

stdDev(x)

Evaluate the standard deviation (uncertainty) of the Gaussian RBF at x.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which the standard deviation should be evaluated.

Returns:

A 1d array containing the standard deviation at x.

Return type:

numpy.ndarray

stdDevGrad(x)

Evaluate the gradient of the standard deviation of the GaussRBF at x.

Parameters:

x (numpy.ndarray) – A 1d array containing the design point at which the gradient of standard deviation should be evaluated.

Returns:

A 2d array containing the Jacobian matrix of the standard deviation at x.

Return type:

numpy.ndarray

improve(x, global_improv)

Suggests a design to evaluate to improve the RBF model near x.

Parameters:
  • x (numpy.ndarray) – A 1d array containing the design point at which the RBF should be improved.

  • global_improv (Boolean) – When True, returns a point for global improvement, ignoring the value of x.

Returns:

A 2d array containing the list of design points that should be evaluated to improve the RBF models.

Return type:

numpy.ndarray

save(filename)

Save important data from this class so that it can be reloaded.

Parameters:

filename (string) – The relative or absolute path to the file where all reload data should be saved.

load(filename)

Reload important data into this class after a previous save.

Parameters:

filename (string) – The relative or absolute path to the file where all reload data has been saved.