# 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.

- Parameters

**kwargsdictOptions dictionary.

`__init__`

(**kwargs)Initialize all attributes.

`linearize`

(x)Calculate the jacobian of the interpolant at the requested point.

- Parameters

xarray-likePoint at which the surrogate Jacobian is evaluated.

`predict`

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

- Parameters

xarray-likePoint(s) at which the surrogate is evaluated.

`train`

(x,y)[source]Train the surrogate model with the given set of inputs and outputs.

- Parameters

xarray-likePoint(s) at which the surrogate is evaluated.

yarray-likeModel responses at given inputs.

`train_multifi`

(x,y)[source]Train the surrogate model, based on the given multi-fidelity training data.

- Parameters

xlist of double array_like elementsA list of arrays with the input at which observations were made, from highest fidelity to lowest fidelity. Designs must be nested with X[i] = np.vstack([…, X[i+1]).

ylist of double array_like elementsA list of arrays with the observations of the scalar output to be predicted, from highest fidelity to lowest fidelity.

`vectorized_predict`

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

- Parameters

xarray-likeVectorized point(s) at which the surrogate is evaluated.

class`openmdao.surrogate_models.surrogate_model.`

`SurrogateModel`

(**kwargs)[source]Bases:

`object`

Base class for surrogate models.

- Parameters

**kwargsdictOptions dictionary.

- Attributes

options<OptionsDictionary>Dictionary with general pyoptsparse options.

trainedboolTrue when surrogate has been trained.

`__init__`

(**kwargs)[source]Initialize all attributes.

`linearize`

(x)[source]Calculate the jacobian of the interpolant at the requested point.

- Parameters

xarray-likePoint at which the surrogate Jacobian is evaluated.

`predict`

(x)[source]Calculate a predicted value of the response based on the current trained model.

- Parameters

xarray-likePoint(s) at which the surrogate is evaluated.

`train`

(x,y)[source]Train the surrogate model with the given set of inputs and outputs.

- Parameters

xarray-likeTraining input locations..

yarray-likeModel responses at given inputs.

`vectorized_predict`

(x)[source]Calculate predicted values of the response based on the current trained model.

- Parameters

xarray-likeVectorized point(s) at which the surrogate is evaluated.