Surrogate Model based on second order response surface equations.

Here is a simple example where the ResponseSurface surrogate is used to approximate the output of a sinusoidal component.

import numpy as np

import openmdao.api as om

prob = om.Problem()

sin_mm = om.MetaModelUnStructuredComp()
sin_mm.add_input('x', 2.1)
sin_mm.add_output('f_x', 0., surrogate=om.ResponseSurface())

prob.model.add_subsystem('sin_mm', sin_mm)


# train the surrogate and check predicted value
sin_mm.options['train_x'] = np.linspace(0, 3.14, 20)
sin_mm.options['train_f_x'] = .5*np.sin(sin_mm.options['train_x'])

prob.set_val('sin_mm.x', 2.1)


/usr/share/miniconda/envs/test/lib/python3.10/site-packages/openmdao/surrogate_models/ FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.
  self.betas, rs, r, s = lstsq(X, y)