Surrogate Models

Base Class

class algorithm.mobo.surrogate_model.base.SurrogateModel(problem_cfg)[source]

Bases: abc.ABC

Base class of surrogate model.

__init__(problem_cfg)[source]

Initialize a surrogate model.

Parameters:problem_cfg (dict) – Problem configurations.
abstract _evaluate(X, std=False, calc_gradient=False, calc_hessian=False)[source]

Predict the performance given a set of design variables.

Parameters:
  • std (bool) – Whether to calculate the standard deviation of the prediction.
  • calc_gradient (bool, default=False) – Whether to calculate the gradient of the prediction.
  • calc_hessian (bool, default=False) – Whether to calculate the hessian of the prediction.
Returns:

out – A output dictionary containing following properties of performance:

  • out[‘F’]: mean, shape (N, n_obj)
  • out[‘dF’]: gradient of mean, shape (N, n_obj, n_var)
  • out[‘hF’]: hessian of mean, shape (N, n_obj, n_var, n_var)
  • out[‘S’]: std, shape (N, n_obj)
  • out[‘dS’]: gradient of std, shape (N, n_obj, n_var)
  • out[‘hS’]: hessian of std, shape (N, n_obj, n_var, n_var)

Return type:

dict

abstract _fit(X, Y)[source]

Fit a surrogate model from data.

Parameters:
  • X (np.array) – Input design variables.
  • Y (np.array) – Input performance values.

Gaussian Process

class algorithm.mobo.surrogate_model.gaussian_process.GaussianProcess(problem_cfg, nu, **kwargs)[source]

Bases: algorithm.mobo.surrogate_model.base.SurrogateModel

Gaussian process.

__init__(problem_cfg, nu, **kwargs)[source]

Initialize a Gaussian process.

Parameters:
  • problem_cfg (dict) – Problem configurations.
  • nu (int) – The parameter nu controlling the type of the Matern kernel. Choices are 1, 3, 5 and -1.
_evaluate(X, std=False, calc_gradient=False, calc_hessian=False)[source]

Predict the performance given a set of design variables.

Parameters:
  • std (bool) – Whether to calculate the standard deviation of the prediction.
  • calc_gradient (bool, default=False) – Whether to calculate the gradient of the prediction.
  • calc_hessian (bool, default=False) – Whether to calculate the hessian of the prediction.
Returns:

out – A output dictionary containing following properties of performance:

  • out[‘F’]: mean, shape (N, n_obj)
  • out[‘dF’]: gradient of mean, shape (N, n_obj, n_var)
  • out[‘hF’]: hessian of mean, shape (N, n_obj, n_var, n_var)
  • out[‘S’]: std, shape (N, n_obj)
  • out[‘dS’]: gradient of std, shape (N, n_obj, n_var)
  • out[‘hS’]: hessian of std, shape (N, n_obj, n_var, n_var)

Return type:

dict

_fit(X, Y)[source]

Fit a surrogate model from data.

Parameters:
  • X (np.array) – Input design variables.
  • Y (np.array) – Input performance values.

Thompson Sampling

class algorithm.mobo.surrogate_model.thompson_sampling.ThompsonSampling(problem_cfg, nu, n_spectral_pts, mean_sample, **kwargs)[source]

Bases: algorithm.mobo.surrogate_model.gaussian_process.GaussianProcess

Sampled functions from Gaussian process using Thompson Sampling.

__init__(problem_cfg, nu, n_spectral_pts, mean_sample, **kwargs)[source]

Initialize a surrogate model from Thompson sampling.

Parameters:
  • problem_cfg (dict) – Problem configurations.
  • nu (int) – The parameter nu controlling the type of the Matern kernel. Choices are 1, 3, 5 and -1.
  • n_spectral_pts (int) – The number of points used in spectral sampling.
  • mean_sample (bool) – Whether to just sample the mean function.
_evaluate(X, std=False, calc_gradient=False, calc_hessian=False)[source]

Predict the performance given a set of design variables.

Parameters:
  • std (bool) – Whether to calculate the standard deviation of the prediction.
  • calc_gradient (bool, default=False) – Whether to calculate the gradient of the prediction.
  • calc_hessian (bool, default=False) – Whether to calculate the hessian of the prediction.
Returns:

out – A output dictionary containing following properties of performance:

  • out[‘F’]: mean, shape (N, n_obj)
  • out[‘dF’]: gradient of mean, shape (N, n_obj, n_var)
  • out[‘hF’]: hessian of mean, shape (N, n_obj, n_var, n_var)
  • out[‘S’]: std, shape (N, n_obj)
  • out[‘dS’]: gradient of std, shape (N, n_obj, n_var)
  • out[‘hS’]: hessian of std, shape (N, n_obj, n_var, n_var)

Return type:

dict

_fit(X, Y)[source]

Fit a surrogate model from data.

Parameters:
  • X (np.array) – Input design variables.
  • Y (np.array) – Input performance values.