surrogate_model.py

Class definition for SurrogateModel, the base class for all surrogate models.

class openmdao.surrogate_models.surrogate_model.MultiFiSurrogateModel(**kwargs)[source]

Bases: openmdao.surrogate_models.surrogate_model.SurrogateModel

Base class for surrogate models using multi-fidelity training data.

__init__(self, **kwargs)

Initialize all attributes.

Parameters
**kwargsdict

options dictionary.

linearize(self, x)

Calculate the jacobian of the interpolant at the requested point.

Parameters
xarray-like

Point at which the surrogate Jacobian is evaluated.

predict(self, x)

Calculate a predicted value of the response based on the current trained model.

Parameters
xarray-like

Point(s) at which the surrogate is evaluated.

train(self, x, y)[source]

Calculate a predicted value of the response based on the current trained model.

Parameters
xarray-like

Point(s) at which the surrogate is evaluated.

yarray-like

Model responses at given inputs.

train_multifi(self, x, y)[source]

Train the surrogate model, based on the given multi-fidelity training data.

Parameters
xlist of (m samples, n inputs) ndarrays

Values representing the multi-fidelity training case inputs.

ylist of ndarray

output training values which corresponds to the multi-fidelity training case input given by x.

vectorized_predict(self, x)

Calculate predicted values of the response based on the current trained model.

Parameters
xarray-like

Vectorized point(s) at which the surrogate is evaluated.

class openmdao.surrogate_models.surrogate_model.SurrogateModel(**kwargs)[source]

Bases: object

Base class for surrogate models.

Attributes

options

(<OptionsDictionary>) Dictionary with general pyoptsparse options.

trained

(bool) True when surrogate has been trained.

__init__(self, **kwargs)[source]

Initialize all attributes.

Parameters
**kwargsdict

options dictionary.

linearize(self, x)[source]

Calculate the jacobian of the interpolant at the requested point.

Parameters
xarray-like

Point at which the surrogate Jacobian is evaluated.

predict(self, x)[source]

Calculate a predicted value of the response based on the current trained model.

Parameters
xarray-like

Point(s) at which the surrogate is evaluated.

train(self, x, y)[source]

Train the surrogate model with the given set of inputs and outputs.

Parameters
xarray-like

Training input locations

yarray-like

Model responses at given inputs.

vectorized_predict(self, x)[source]

Calculate predicted values of the response based on the current trained model.

Parameters
xarray-like

Vectorized point(s) at which the surrogate is evaluated.